Jump to content

events and CSS


Guest axipher

Recommended Posts

Guest axipher

Hey guys and gals, this is probably an easy problem, but I can't figure it out. Now if it can't be done, then I have another way, but if it can then great.Now my problem is that I have a <div> tag for each menu item in a menu and I would likke to have it so I can use onmouseover and onmouseout to change the background color of that div. I already have class="menuitem" in each <div> tag so I was hoping I could edit the CSS properties of .menuitem in the stylesheet to do this instead of each <div> seperately as I'm doing now.Here;s how I;m doing it now:

<div class="menuitem"     onmouseover="this.style.background='#008000'"   onmouseout="this.style.background='#000'">Option</div>

Link to comment
Share on other sites

Well, you could usediv:hover.menuitem {}but IE6 and lower doesn't support :hover on any elements other than anchor elements. You could, however, instead of div's, display your anchors as block elements:a.menuitem {display: block;width: same as the width you now have on the divs;height: same as the height you now have on the divs;background: #000;}a:hover.menuitem {background: #008000;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...