1

I have a menu structure:

<ul id="nav_menu">
    <li><a href="#!index?category_id=3" class="subcategory">Electronics</a>
        <ul>
            <li><a href="#!index?category_id=15">Mobile phones</a></li>
        </ul>
    </li>
    <li><a href="#!index?category_id=4">Computers</a></li>
    <li><a href="#!index?category_id=5">Car Electronics</a></li>
    <li><a href="#!index?category_id=6">TV &amp; Video</a></li>
    <li><a href="#!index?category_id=7">Cell Phones</a></li>
    <li><a href="#!index?category_id=8">MP3 Players</a></li>
    <li><a href="#!index?category_id=9">Cameras &amp; Photo</a></li>
    <li><a href="#!index?category_id=10">Apparel</a></li>
    <li><a href="#!index?category_id=11">Music</a></li>
    <li><a href="#!index?category_id=12">Movies &amp; TV</a></li>
    <li><a href="#!index?category_id=13">Video Games</a></li>
    <li><a href="#!index?category_id=14">Office Supplies</a></li>
</ul>

But it looks like below:

enter image description here

Is it possible to optimize menu if I have a lot of categories and my device screen width is narrow?

My CSS:

#nav_menu li {
    display: inline;
    float: left;
    padding-right: 3px;
    position: relative;
}

#nav_menu > li > a {
    background: none repeat scroll 0 0 #404040;
    border-radius: 3px 3px 0 0;
    color: #FFFFFF;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: 28px;
    line-height: 28px;
    padding: 0 5px;
    text-decoration: none;
}
#nav_menu ul {
    background: none repeat scroll 0 0 #404040;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
    list-style: none outside none;
    margin: 0;
    padding: 5px;
    position: absolute;
    top: 36px;
    width: 140px;
    z-index: 2;
}
1
  • 1
    How about off the shelf responsive menu solutions? I mean, do you have to use this design? Commented Aug 16, 2013 at 7:07

2 Answers 2

1

Like this

DEMO

CSS

#nav_menu ul{
    margin:0;
    padding:0;
    float:left;
}
#nav_menu li {
    display: inline;
    float: left;
    padding-right: 3px;
    position: relative;
     border-bottom:#FFD700 3px solid;
}

#nav_menu > li > a {
    background: none repeat scroll 0 0 #404040;
    border-radius: 3px 3px 0 0;
    color: #FFFFFF;
    display: block;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    padding: 0 5px;
    text-decoration: none;


}
#nav_menu ul {
    background: none repeat scroll 0 0 #404040;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
    list-style: none outside none;
    margin: 0;
    padding: 5px;
    position: absolute;
    top: 20px;
    width: 140px;
    z-index: 2;
}
Sign up to request clarification or add additional context in comments.

Comments

0

prueba lo siguiente:

DEMO 1

JAVASCRIPT

$(document).ready(function()
{
    $("div.po").set_ELEMENT(
    {
        bgColor:'red',

        click: function(oThis)
        {
            oThis.find('> div').css({'color':'red','background-color' : 'blue'});
        }
     });
});

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.