Jump to content

[SOLVED] css driven menu help


Stickybomb

Recommended Posts

ok i am having problems trying to create a simple ul menu with css

 

exp:

 

HTML

<ul class="menu">
    <li><a href="/">Test link #1</a>
        <ul>
            <li><a href="/">Submenu link #1</a></li>
            <li><a href="/">Submenu link #2</a></li>
        </ul>
    </li>

    <li><a href="/">Test link #2</a>
            <ul>
                <li><a href="/">Submenu link #3</a></li>                
                <li><a href="/">Submenu link #4</a></li>                
                <li><a href="/">Submenu link #5</a></li>                                
            </ul>
     </li>
</ul>

 

basically i am just trying to grasp the idea of how it works, i have done them using javascript before but would like to learn how to do it with only css. i know css so i can format the text and background colors and background hovers. My main problem is that i can not seem to figure out how you hide and display the menu using only the hover, if anyone could explain this to me  it would help alot.

 

my attempt

 

CSS

.menu,.menu ul { list-style : none; }
.menu {font-family:veranda; font-weight:bolder;font-size:12px; color:white;}
.menu ul {display:none;}
.menu li {background:#7f8fbf; display:inline;}
.menu li:hover {background:#7f80b0;}
.menu li:hover ul {display:box;}
.menu il ul li:hover {background:#7f80b0;}

Link to comment
Share on other sites

  • 2 weeks later...

Well, I tested out the code you showed out of curiosity.  The main reason the menu is displaying is because in one of your css lines:

 

.menu li:hover ul {display:box;}

 

the box value you assigned to the display property does not seem to exist, according to the reference sheet found at http://www.w3schools.com/css/css_reference.asp

 

If you replace the box display value with block like this:

 

.menu li:hover ul {display:block;}

 

then the menu should work as it did with me

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.