简体   繁体   中英

UL LI Horizontal List

I have created a simple UL/LI navigation bar. It looks perfectly fine in both IE and Chrome, however in firefox any element after the first element is shifted down by about 35 pixels. I have tried just about everything I could think of to fix this and just cant seem to get it right.

Here is my current code:

HTML

<div class="navigation">
        <ul>
            <li><a href="" class="button_selected_tab"><span>Home</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>My Calendar</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>Catalog</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>My Learning</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>Shopping Cart</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>My Account</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>Support</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>Sign Out</span></a></li>
            <li><a href="" class="button_inactive_tab"><span>Admin View</span></a></li>
        </ul>
        <div class="clear_float">
            &nbsp;
        </div>
    </div>

CSS:

.navigation {
           left: 1px;
           position: absolute;
           text-align: right;
           top: 7px;
            white-space: nowrap;
        }

        .navigation ul {
           list-style: none;
           margin: 0px;
           padding: 0px;
        }

        .navigation ul li {
           display: inline;
           margin-right: 2px;
        }

        .navigation ul li a {
           display: inline-block;
           line-height: 17px;
           /*
        padding: 1px 11px 0px
        */;
           text-decoration: none;
        }
        a.button_selected_tab {
            background: transparent url('images/orange_button_right.png') no-repeat scroll top right;
            display: block;
            float: left;
            font: normal 12px arial, sans-serif;
            height: 28px;
            margin-right: 6px;
            padding-right: 7px; /* sliding doors padding */
            text-decoration: none;
            color: #FFFFFF;
        }

        a.button_selected_tab span {
            background: transparent url('images/orange_button_left.png') no-repeat;
            display: block;
            line-height: 28px;
            padding: 0px 10px 10px 15px;
        }

        a.button_inactive_tab {
            background: transparent url('images/grey_button_right.png') no-repeat scroll top right;
            display: block;
            float: left;
            font: normal 12px arial, sans-serif;
            height: 28px;
            margin-right: 6px;
            padding-right: 7px; /* sliding doors padding */
            text-decoration: none;
            color: #FFFFFF;
        }

        a.button_inactive_tab span {
            background: transparent url('images/grey_button_left.png') no-repeat;
            display: block;
            line-height: 28px;
            padding: 0px 10px 10px 15px;
        }

I made an example with your code, and removing margin-right:2px; from .navigation ul li set all the elements in the same line. Is this what you need?

Example: http://jsbin.com/uhace3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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