【发布时间】:2018-03-18 04:28:09
【问题描述】:
我需要创建一个如下图所示的表单:
我不确定是否可以使用 html。 问题是我无法将标签宽度更改为与内容的宽度完全相同。
我用表格和 ul 列表尝试过。 表格有表格大小问题,列出对齐问题。
我不喜欢其中一种方式。我只是想让它工作。
有没有办法做到这一点?
编辑: html:
<form>
<table>
<tr><td>NAAM</td><td class="rechts"><input type="text" name="naam" /></td></tr>
<tr><td>VOORNAAM</td><td class="rechts"><input type="text" name="voornaam" /></td></tr>
<tr><td>E-MAIL</td><td class="rechts"><input type="text" name="voornaam" /></td></tr>
<tr><td></td><td><input type="radio" name="vraag" value="vraag" /> VRAAG
<input type="radio" name="vraag" value="nieuwsbrief" /> NIEUWSBRIEF<td></tr>
<tr><td></td><td class="rechts"><textarea rows="4" cols="50"></textarea></td></tr>
<tr><td></td><td class="rechts"><input type="submit" value="Verzenden" /></td></tr>
</table>
</form>
css:
#contactleft{ /* So: This is a div floating to the left with the adress etc */
width: 250px;
margin-top:50px;
padding-top:10px;
float:left;
border-right: solid #b5b5b5 2px;
}
#contactleft p{
margin-left:50px;
font-family: Ubuntu Condensed;
font-size: 14pt;
line-height:1.5em;
}
#contactright{ /* So: This is the div where the form is in. */
float:right;
width:690px;
margin-top:50px;
padding-bottom: 20px;
font-family: Ubuntu Condensed;
font-size: 14pt;
line-height:1.5em;
list-style-type:none;
}
#contactright form{
padding-top: 10px;
padding-left: 50px;
}
#contactright form table{
}
#contactright form table td{
}
#contactright .rechts{
width: 100%;
padding-right: 150px;
}
#contactright .rechts input{
width: 100%;
}
编辑:我以丑陋的方式做到了。我刚刚为每一行创建了一个新表,并提供了我需要的结果。
【问题讨论】:
-
向我们展示您迄今为止尝试过的代码?
-
@samirchauhan 我不断地改变它。目前正在尝试一种表格样式。我会将当前代码粘贴到问题中
标签: html css forms html-table