I have 2 html radio buttons (separated by <br />
tags) where the text is wrapping under the radio button instead of aligning with the left indent (due to the size it's containing div). The text wrapping is not the problem, the problem is that it is wrapping incorrectly under the radio button itself, instead of aligning with text in the line above it. I'm supposing someone styled the input tag somewhere in the cascade. I haven't done an exhaustive search of all the styles attached to this page, but shouldnt the text just automatically wrap correctly, like a bullet list?
如果没有,我该如何解决这个问题?我需要插入一个<br />
标记我想要断线的位置,以便它们正确对齐?
Thanks!
首先,使用一个<br />
一般不推荐,尝试使用会更好margin
用于在元素之间创建空间的 CSS 属性。
在这种情况下,最好使用 CSS 来完成您想做的事情。这是因为默认情况下这些元素不会有这种行为。
在这种情况下,你会想要看起来像这样的东西:
<div style="width:300px">
<input type="radio" class="radioLeft" />
<div class="textBlock">
Some text that is too long to fit inline and must be broken
up over multiple lines.Some text that is too long to fit inline
and must be broken up over multiple lines.Some text that is too
long to fit inline and must be broken up over multiple lines.
</div>
<div style="clear:both;"></div> //this is important for repeated inputs
</div>
然后你的 CSS 看起来像这样:
.radioLeft
{
float: left;
}
.textBlock
{
float: left;
width: 80%; //Adjust this value to fit
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)