View Full Version : CSS Menu Help
wyclef
January 21st, 2004, 11:05 AM
Hi, I really need some help figureing this out. Can someone take a look at this CSS Menu i've put together and help me figure out how to get it work in both netscape and explorer. Right now it's working best in Explorer but it's pretty common menu so there is probably a much more efficient way of doing it without using pixel shims, etc. Any help would be greatly appreciated. Thanks. :jail:
λ
January 21st, 2004, 11:52 AM
I've almost got it working.. works in Mozilla 1.6 perfectly, Opera perfectly, but not in IE... sadly, the links are still blue :(. But it's perfectly semantic and everything (no tables)... if I knew more JavaScript I could probably make it work in IE too...
<!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>
<script type="text/javascript">
function s(x){
x.style.backgroundColor = '#ccc';
x.style.color = 'green';
}
function rs(x){
x.style.backgroundColor = '#fff';
x.style.color = 'red';
}
</script>
<style type="text/css">
html {
font-family: Verdana, Geneva, Helvetica, Arial, sans serif;
font-size:10px;
font-weight:bold;
}
#menu {
position:relative;
top:5px;
}
#menu li {
color:red;
}
#menu a {
color:inherit;
text-decoration:none;
}
#menu li {
margin-left:-4px;
display:inline;
padding:10px;
border:1px solid #ccc;
letter-spacing:1px;
}
</style>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<ul id="menu">
<li onmouseover="s(this);" onmouseout="rs(this)"><a href="">Home</a></li>
<li onmouseover="s(this);" onmouseout="rs(this)"><a href="">Services</a></li>
<li onmouseover="s(this);" onmouseout="rs(this)"><a href="">Company</a></li>
<li onmouseover="s(this);" onmouseout="rs(this)"><a href="">Contact</a></li>
<li onmouseover="s(this);" onmouseout="rs(this)"><a href="">FAQs</a></li>
</ul>
</body>
</html>
wyclef
January 22nd, 2004, 06:06 PM
I'd really like to do it without using Javascript and definately need it to work in Explorer. I've tried to simplify things and clean up my files so maybe it makes a little more sense. I've also included a gif of what the thing should actually look like. I think it works best right now in Explorer 5+ or Netscape 7.1 on mac but it is all messed up still. Can someone please take a look at this and help me figure out how to create this thing so it works in all browsers (most recent browsers that is...) and cross platform (mac/pc)? I feel it's very close and just needs some tweaking. Also, i'd like to keep the three horizontal lines as graphics unless the only way to fix all this is make them using styles. Your help is greatly appreciated. Thanks.
wyclef
January 22nd, 2004, 07:31 PM
I've been now looking into the alignment of those DIVs between those line graphics and am thinking the DOCTYPE could also be part of the solution. I'll keep you posted. Thanks.
wyclef
January 23rd, 2004, 07:13 PM
I'm totally and completely stuck. If anyone can help me out i'd greatly appreciate it. :(
λ
January 24th, 2004, 04:03 AM
You can't do it without using JavaScript... IE doesn't support the :hover state for anything but a tags.
I could have another look at it later.. I think I've figured out a way of making it work :)
[m]
January 24th, 2004, 01:11 PM
njs12345 ...Just look at what you said. :hover only works on a elements, so you revert to js. But there is already an a element in there. :S
I refer you to list-o-matic (http://www.accessify.com/tools-and-wizards/list-o-matic/list-o-matic.asp) and listutorial (http://css.maxdesign.com.au/listutorial/).
Happy hunting!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.