我有以下HTML ...
<div>
<input type="radio" value="some value">some text here<br />
<input type="radio" value="some value">some text here and long<br />
</div>
div的宽度为110像素。当某些文字出现在下面时,它应该像这样在同一行。
o some text
o some text
and logn
答案 0 :(得分:1)
这可以通过在代码中添加一些css来完成。
<强> HTML:强>
<div>
<input type="radio" value="some value" />
<label>some text here</label>
<br />
<input type="radio" value="some value" />
<label>some text here and long</label>
<br />
</div>
<强> CSS:强>
div {
width: 110px;
}
input[type="radio"] {
float: left;
}
label {
float: left;
width: 80%;
}
选中此JSFiddle
答案 1 :(得分:0)
尝试将它放在这样的表格上:
<div style="width: 110px;">
<table>
<tr>
<td><input type="radio" value="some value"></td>
<td>some text here</td>
</tr>
<tr>
<td><input type="radio" value="some value"></td>
<td>some text here and long</td>
</tr>
</table>
</div>
答案 2 :(得分:0)