0

i have this css and html for a horizontal menu:

.nav > li:hover {
    background: #666666;
    text-decoration:none;
}
.active {
    background: #666666;
    text-decoration:none;
}
nav, ul, li, a {
    margin: 0;
    padding: 0;
}
a {
    text-decoration: none;
}
.container {
    width: 100%;
    margin: 10px auto;
}
.toggleMenu {
    display: none;
    background: #666666;
    padding: 10px 15px;
    color: #ffffff;
    width:100%;
    text-align:center;
}
.nav {
    list-style: none;
    *zoom: 1;
    background:#f36f25;
    text-align: center;
}
.nav:before,.nav:after {
    content: " "; 
    display: table; 
}
.nav:after {
    clear: both;
}
.nav ul {
    list-style: none;
    width: 12em;
}
.nav a {
    padding: 10px 15px;
    color:#fff;
}
.nav li {
    position: relative;
    text-align: left;
}
.nav > li {
    display: inline-block;
}
.nav > li > .parent {
    background-image: url("/images/downArrow.png");
    background-repeat: no-repeat;
    background-position: right;
}
.nav > li > a {
    display: block;
}
.nav li  ul {
    position: absolute;
    left: -9999px;
}
.nav > li.hover > ul {
    left: 0;
}
.nav li li.hover ul {
    left: 100%;
    top: 0;
}
.nav li li a {
    display: block;
    background: #666666;
    position: relative;
    z-index:100;
    border-top: 1px solid #ffffff;
}
.nav li li li a {
    background:#f36f25;
    color:#ffffff;
    z-index:200;
    border-top: 1px solid #ffffff;
}

@media screen and (max-width: 760px) {
    .active {
        display: block;
    }
    .nav {
        border-top: none;
    }
    .nav > li {
        display: block;
        border-top: 1px solid #ffffff;
    }
    .nav > li > .parent {
        background-position: 95% 50%;
    }
    .nav li li .parent {
        background-image: url("/images/downArrow.png");
        background-repeat: no-repeat;
        background-position: 95% 50%;
    }
    .nav ul {
        display: block;
        width: 100%;
    }
   .nav > li.hover > ul , .nav li li.hover ul {
        position: static;
    }
}

<a class="toggleMenu" href="#">Menu</a>
<ul class="nav">
<li><a href=""><span>Homepage</span></a></li>
<li><a href=""><span>About Us</span></a>
    <ul>
        <li><a href=""><span>Who Are We?</span></a></li>
        <li><a href=""><span>Service Status</span></a></li>
        <li><a href=""><span>Contact Us</span></a></li>
        <li><a href=""><span>Terms & Conditions</span></a></li>
    </ul>
</li>
</ul>

how can i make the main menu links align right rather than centre?

here is a fiddle: http://jsfiddle.net/B5jtm/

3 Answers 3

1

Try this:

.nav {text-align: right;}
Sign up to request clarification or add additional context in comments.

Comments

1

Change:

text-align: center;

to:

text-align: right;

in:

.nav {
    list-style: none;
    *zoom: 1;
    background:#f36f25;
    text-align: right;
}

jsFiddle example

Comments

0

I removed text-align on the .togglemenu and changed .nav to text-align: right

Please see updated jsFiddle: http://jsfiddle.net/B5jtm/10/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.