Jump to content

submenu's go up and not down


lional

Recommended Posts

Hi

I am trying to make my pop-up menu go up and not down with CSS.

I have images using css for my rollovers. I will attach my code

 

HTML File snippet

<div id="navcontainer"> 
        <ul id="navlist"> 
            <li id="active"> 
                <a href="#" id="current">Item one</a> 
                <ul id="subnavlist"> 
                    <li><a href="#">link 1</a></li> 
                    <li><a href="#">link 2</a></li> 
                    <li><a href="#">link 3</a></li> 
                    <li><a href="#">link 4</a></li> 
                </ul> 
            </li> 
            <li><a href="#">Item two</a></li> 
            <li><a href="#">Item three</a></li> 
        </ul> 
    </div> 
    <div id="content"> 
        <img alt="" src="images/image.png" 
            style="width: 862px; height: 324px" /> 
    </div> 

CSS

ul#subnavlist { display: none; } 
ul#subnavlist li { float: none; } 

ul#subnavlist li a 
{ 
padding: 0px; 
margin: 0px; 
} 
#navcontainer 
{ 
    height:30px; 
    background-color: #C7C8CA; 
    padding-left:10%; 
} 

ul#navlist 
{ 
    font-family: Arial; 
} 

ul#navlist a 
{ 
    text-decoration: none; 
} 

ul#navlist 
{ 
    margin: 0px; 
    padding: 5px 0px 0px 0px; 
    list-style-type: none; 
} 
  
ul#navlist ul 
{ 
    margin: 0px; 
    padding: 0px; 
    list-style-type: none; 
} 
  
ul#navlist li 
{ 
    margin: 0px; 
    padding: 0px; 
    list-style-type: none; 
    float: left; 
} 

ul#navlist li a 
{ 
color: #ffffff; 
background-color: #003366; 
padding: 3px; 
border: 1px #ffffff outset; 
} 

ul#navlist li a:hover 
{ 
color: #ffff00; 
background-color: #003366; 

}
ul#navlist li a:active 
{ 
color: #cccccc; 
background-color: #003366; 
border: 1px #ffffff inset; 
} 

ul#subnavlist { display: none;margin-bottom:50px } 
ul#subnavlist li { float: none; } 

ul#subnavlist li a 
{ 
padding: 0px; 

} 

ul#navlist li:hover ul#subnavlist 
{ 
display: block; 
position: absolute; 
font-size: 8pt; 
padding-top: 5px;

} 

ul#navlist li:hover ul#subnavlist li a 
{ 
display: block; 
width: 10em; 
border: none; 
padding: 2px;

} 

 

Is this possible

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/265025-submenus-go-up-and-not-down/
Share on other sites

If you do this, make sure you check what happens when the user is near the edge of the page. I've seen implementations like this before, and they become unusable in certain positions.

 

In situations like this, it's usually best not to screw with the default browser behavior.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.