A picture says more than a thousand words?
I would like the second (and consecuti开发者_开发问答ve) lines to be aligned with the first. Any ideas?
Html is
<input><span>text</span>
.thing input { float: left; }
.thing label { display: block; margin-left: 2em; }
<div class="thing">
<input type="radio" id="potato"/>
<label for="potato">Text over multiple lines should be aligned properly...</label>
</div>
I ran into the same things and solved it this way. The big problem was checkbox list items whose text took up multiple lines.
HTML
<div class="checkboxlist">
<ul>
<li>
<asp:CheckBox ID="CheckBox1" runat="server" Text="This is a checkbox option in an unordered list that is pretty long and ends u wrapping onto another line, but maintains alignment" />
</li>
<li>
<asp:CheckBox ID="CheckBox2" runat="server" Text="This is yet another checkbox option in an unordered list that is pretty long and ends u wrapping onto another line, but maintains alignment" />
<div>
<br /> Here's some other info as well that isn't a part of the checkbox. The alignment for this works as well.
</div>
</li>
</ul>
</div>
CSS
div.checkboxlist ul li { margin: 7px 0px; }
div.checkboxlist ul li input { width: 15px; display: block; float:left;}
div.checkboxlist ul li label { padding-left: 28px; display: block; }
div.checkboxlist ul li div { margin-left: 28px; clear: both; font-size: .9em; }
For a more detailed discussion see my post here: Aligning a List of Checkboxes with Text that Wraps
精彩评论