简体   繁体   English

CSS-帮助设置菜单项的样式

[英]CSS - Help styling my menu items

CODE

<div class="navheader">
     <ul class="navuseraccess">
        <li><a runat="server" id="mnuAccount" href="AccountSettings.aspx">My Account</a></li>
     </ul>
</div>

CSS 的CSS

div.navheader {
    overflow: hidden;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 775px;
    height: 43px;
    margin: 0;
    padding: 0 20px 0px 20px;
    list-style-type: none;
    background-image: url(../images/header_bkg_navmain.jpg);
    background-repeat: no-repeat;
}

ul.navuseraccess {
    float: right;
    height: 43px;
    margin: 0;
    padding: 0;
    list-style-type: none;
}
.navuseraccess li {
    float: left;
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 13px;
    line-height: 43px;
}
.navuseraccess li a {
    display: block;
    height: 43px;
    color: #fff;
    margin: 0;
    padding: 0 8px;
    text-decoration: none;
    line-height: 43px;
}

What I'm trying to do is add a new listitem-anchor but want it to display beneath the existing one, and not next to it. 我想要做的是添加一个新的listitem-anchor,但希望它显示在现有的listitem-anchor之下,而不是在其旁边。 So I'm guessing I'm going to have to move the existing one up a bit, then add a new one beneath it. 因此,我猜测我将不得不将现有的移动一点,然后在其下方添加一个新的。

You don't need to float the elements. 您不需要float元素。 They are already shrink-wrapped because they are contained within a position: absolute element. 它们已经被收缩包装,因为它们包含在position: absolute元素中。 This element will grow as needed, anchored to the bottom right of the page so long as you remove the height and width properties. 只要您删除heightwidth属性,该元素就会根据需要增长,并固定在页面的右下方。

See it in action: http://jsfiddle.net/MJrfX/ 实际观看: http : //jsfiddle.net/MJrfX/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM