...

View Full Version : CSS: Positioning a pop out navigation menu



RandomRobbo
08-07-2011, 10:09 PM
Hi,

I am putting a pop out navigation menu together but I cannot seem to position it to where I want it to be.

I want it to be 100px from the top, What do I need to change in my CSS file to adjust it?




//The CSS File

#menu {
width: 12em;
background:#eee;
}
#menu ul {
list-style: none;
margin: 0;
padding: 0;
}

#menu a, #menu h2 {
font: bold 11px/16px arial, helvetica, sans-serif;
width:17em;
height:3.6em;
display: block;
border-width: 1px;
border-style: solid;
border-color: #ccc #888 #555 #bbb;
margin: 0;
padding: 2px 3px;
}

#menu h2 {
color: #fff;
background-image:url(Images/Buttonbkg.jpg);
text-transform: uppercase;
}

#menu a {
color: #000;
background-image:url(Images/Buttonbkg.jpg);
text-decoration: none;
}

#menu a:hover {
color: #fff;
background-image:url(Images/Buttonbkg2.jpg);
}

/* The slide out menu*/

#menu ul ul ul {
position: absolute;
top:0;
left: 0;
}

#menu li {
position: relative;
top:0;
}

#menu ul ul ul {
position: absolute;
top:0;
left: 100%;
width: 100%;
}



/* makes the menu appear and disappear*/

div#menu ul ul ul
{display: none;}

div#menu ul ul li:hover ul
{display: block;}

div#menu ul ul ul,
div#menu ul ul li:hover ul ul
{display: none;}

/* Allows the first pop out layers to be displayed*/

div#menu ul ul li:hover ul
{display: block;}

div#menu ul ul ul,
div#menu ul ul li:hover ul ul
{display: none;}

div#menu ul ul li:hover ul,
div#menu ul ul ul li:hover ul
{display: block;}



Html file




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="popout.css" rel="stylesheet" type="text/css" />
<title>Untitled Document</title>
</head>

<body>
<!--[if IE]>
<style type="text/css" media="screen">
body {behavior: url(csshover.htc);}

</style>
<![endif]-->
<div id="menu">
<ul>
<li><h2>Weather In A Flash</h2>
<ul>
<li><a href="" title="">Current Weather</a>
<ul>
<li><a href="" title="">United Kingdon</a></li>
<li><a href="" title="">World Weather</a></li>
<li><a href="" title="">Lancashire</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="" title="">Lightning</a>
<ul>
<li><a href="" title="">Live Lightning</a></li>
<li><a href="" title="">Lightning (15 min Delay)</a></li>
<li><a href="" title="">Current Storms</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="" title="">Weather Forecast</a>
<ul>
<li><a href="" title="">Five Day Forecast</a></li>
<li><a href="" title="">Choose Your County</a></li>
<li><a href="" title="">Sub Option 3</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="" title="">Photo Albums</a>
<ul>
<li><a href="" title="">Photo Album 1</a></li>
<li><a href="" title="">Photo Album 2</a></li>
<li><a href="" title="">Photo Album 3</a></li>
<li><a href="" title="">Photo Album 4</a></li>
</ul>
</li>
</ul>

<!-- need these below -->

</li>
</ul>
</div>
</body>
</html>



Thanks

RandomRobbo:rolleyes:

mikhial66
08-07-2011, 11:54 PM
#menu {
width: 12em;
background:#eee;
position:absolute;
top:100px;
margin: 0 auto; /*center it*/
}

RandomRobbo
08-08-2011, 08:11 PM
Mikhail66, you are a star!

Thank you very much!

RandomRobbo :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum