Hi ,This is my HTML
<div style="width:220px;float:left;" id="radio_text">
<ul style="width:20px;float:left;di开发者_高级运维splay:block;">
<li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" checked="true" /></li>
<li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" /></li>
<li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" /></li>
</ul>
<ul style="width:200px;float:left;">
<li style="list-style:none;line-height:13px;height:13px;width: 200px;float:left;">Show All</li>
<li style="list-style:none;line-height:13px;height:13px;width: 200px;float:left;">Show Only Members</li>
<li style="list-style:none;line-height:13px;height:13px;width: 200px;float:left;">Show Only Accepted Contacts</li>
</ul>
</div>
My CSS
#radio_text ul{float:left;}
#radio_text ul li{background: none;border:none;color: #000000;float: left;font-family: Arial,Helvetica,sans-serif;font-size: 11px;font-weight: normal;margin-right: 2px;padding: 1px 7px;text-align: left;}
and My Outputs
Please Help me to show it properly in IE 7
Thanks
I don't know the exact situation you are programming, byt why wouldn't you change your HTML to this :
<div style="width:220px;float:left;" id="radio_text">
<ul style="float:left;display:block;">
<li style="list-style:none;line-height:13px;height:13px;">
<input type="radio" name="radio_flag" checked="true" />
<span class="radio-text">Show All</span>
</li>
<li style="list-style:none;line-height:13px;height:13px;">
<input type="radio" name="radio_flag" />
<span class="radio-text">Show Only Members</span>
</li>
<li style="list-style:none;line-height:13px;height:13px;">
<input type="radio" name="radio_flag" />
<span class="radio-text">Show Only Accepted Contacts</span>
</li>
</ul>
</div>
This way, the text is automatically next to the radio button. You could also wrap a <label> tag around the radio button and the span, so the radio button gets checked when a user clicks on the text.
<label><input type="radio" name="rbtn"/><span>text</span></label>
And I agree, it is best to place all the style attributes in the external stylesheet.
精彩评论