开发者

Presentation Issue in an Unordered List

开发者 https://www.devze.com 2023-01-02 09:26 出处:网络
I\'m having an issue with correctly presenting items in an unordered list.The labels are floating left and the related spans that are long in length are wrapping and showing below the label.I need a s

I'm having an issue with correctly presenting items in an unordered list. The labels are floating left and the related spans that are long in length are wrapping and showing below the label. I need a solution that keeps the related spans in their respective columns. In other words, I don't want long spans to show under the labels. What property can I take advant开发者_JAVA技巧age of so that I get the desired layout in all of the popular browsers, including IE6? Thanks in advance for the help.

My code is as follows:

<ul>
    <li>
        <label>Name</label>
        <span><%= Html.Encode(Model.Name) %></span>
    </li>
    <li>
        <label>Entity</label>
        <span><%= Html.Encode(Model.Entity) %></span>
    </li>
    <li>
        <label>Phone</label>
        <span><%= Html.Encode(Model.Phone) %></span>
    </li>
</ul>

My CSS styling is as follows:

ul
{
    display:block;
    list-style-type:none;
    margin:0;
    padding:0;
}

ul li label
{
    float:left;
    width:100px;
}


This works in Firefox. It should also work in IE6.

ul li span {
    display: block;
    margin-left: 100px;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消