/    Sign up×
Community /Pin to ProfileBookmark

css drop down menu problem

hi,
I have this problem with a drop down menu code I found online. When the horizontal menu (on top of page) drops down the rest of the content that is in the same site moves down for a space equal to the height of the drop down list. Any idea how can i fix this?
the css i found is the following

[CODE]
body {
margin: 0;
padding: 0;
font: 80% verdana, arial, sans-serif;
}
dl, dt, dd, ul, li {
margin: 0;
padding: 0;
list-style-type: none;
}
#menu {
position: relative; /* Menu position that can be changed at will */
top: 0;
left: 0;
z-index:100;
width: 100%; /* precision for Opera */
}
#menu dl {
float: left;
width: 12em;
}
#menu dt {
color:#f2f2e6;
cursor: pointer;
text-align: center;
font-weight: bold;
background: #00592d;
border: 1px solid gray;
margin: 1px;
}
#menu dd {
display: none;
border: 1px solid gray;
}
#menu li {
text-align: center;
background: #fff;
position: relative;
}
#menu li a, #menu dt a {
color: #f2f2e6;
text-decoration: none;
display: block;
height: 100%;
border: 0 none;
}
#menu li a:hover, #menu li a:focus, #menu dt a:hover, #menu dt a:focus {
color:#00592d;
background: #eee;
}
#site {
position: absolute;
z-index: 1;
top : 70px;
left : 10px;
color: #000;
background-color: #ddd;
padding: 5px;
border: 1px solid gray;
}
[/CODE]

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@CentauriDec 04.2007 — Can't tell much from that snippet of code without the html. Would suggest you have a read about the suckerfish method.
Copy linkTweet thisAlerts:
@harumphDec 04.2007 — Remove height: 100%;
Copy linkTweet thisAlerts:
@yona_tauthorDec 05.2007 — removing height:100% unfortunately caused no change.

The piece of code I guess I should include is the javascript that loads the menu and is the following
[CODE]
function show(id) {
var d = document.getElementById(id);
for (var i = 1; i<=10; i++) {
if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
}
if (d) {d.style.display='block';}
}
[/CODE]


I tried changing the display property but the results where more or less the same...

The code on the html is just a table and a div inside it where I applied the menu css...

Thank you for your time
Copy linkTweet thisAlerts:
@CentauriDec 05.2007 — Anyone without javascript will not be able to see or navigate the menu (including search engines). Again, I recommend the Suckerfish method...
Copy linkTweet thisAlerts:
@harumphDec 05.2007 — Can you show us how you're using it?

(You might be able to avoid Javascript all together.)
Copy linkTweet thisAlerts:
@mattrochDec 06.2007 — Anyone without javascript will not be able to see or navigate the menu (including search engines). Again, I recommend the Suckerfish method...[/QUOTE]

thanks for the link! seems nice, though not working properly in IE7 on first look. will look a little deeper into it at a later time...
Copy linkTweet thisAlerts:
@joseph_liuDec 07.2007 — Not to hijack this thread, but I am using the suckerfish method and I have having some spacing issues in IE6.

Could anyone here take a look at my post and let me know if you have any ideas?

Thanks in advance!

https://webdeveloper.com/forum/showthread.php?t=168014
×

Success!

Help @yona_t spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...