Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Strange CSS hover behaviour
Old 08-17-2006, 12:11 PM Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
I have a CSS menu at the following website:

Kennedy's Mica: Hardware and DIY equipment direct from Rubery, West Midlands

For some reason, the menu isn't rendered correctly, and it appears to be a problem which only occurs when a hover is set up on the .menuitem class.

Any ideas?
futurevisions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-17-2006, 03:17 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
Note: On this page, the menu should be as expected in the CSS. For some reason, the hover style forces the div to shrink.
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 03:28 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You've got some very bizarre behavior with that menu in IE, I think it's dropping the float.

On FF, all I see is 1 piece of the menu image on the first item.

Are you using PHP on that page ? If not, take this out from the top of your page:
<?xml version="1.0" encoding="ISO-8859-1" ?>

That will throw IE into quirks mode.

Make your menu an unordered list.

When you use the pseudo classes, they must be in a specific order, or problems occur:
Link, Visited, Hover, Active - just remember LoVeHAte

Your .menubox is specifed at 160px.. BUT, your HOVER image is 250px wide.. that's causing the float drop in IE,
your menubox needs to be as wide as your image.

If you put the menu in a list, you can better control the spacing and the image background.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 03:42 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
I don't know how to do it as a list - you couldn't fire any tips my way could you?

So I understand that I have to add the properties for a class on the <ul> tag, but is there anything else I have to do?
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 03:53 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Have a look at the code and CSS on this site (one of mine):
Southern Kentucky Urology - Adult and Pediatric Urology Care

Simple list menu, I use it all the time, not difficult to implement.

You might also want to read this tutorial: Listutorial: Step by step CSS list tutorial
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 04:22 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
OK, so I've made some changes to have the menu in the form of a list. Is there any chance you'd please be able to have a look and tell me what's wrong with it? Just to point me in the right direction?
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 05:16 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Sure. Try it this way:

CSS:

Quote:
#menubox{
width: 160px;
float: right;
margin-right: 45px;
margin-top: 20px;
display: inline; /* defeats another IE bug, the double-margin bug */
}

#menubox ul {
list-style-type: none;
margin: 0 0 5px 0;
padding: 0;

}

#menubox ul li{
width: 160px;
margin-bottom: 5px;
font-weight: bold;
font-size: 110%; - adjust to fit to what looks good to you.
color: white;
}


#menubox li a{
background: url('images/menubutton.gif') no-repeat;
display: block;
height: 1%; /* these 2 lines kill an IE bug */
vertical-align: bottom;
text-decoration: none;
padding: 10px 0 18px 19px; /*this padding adds the space to display your button image */
color: white;
}

#menubox li a:hover {
background: url('images/menubutton_h.gif') no-repeat;
color: red;
}
Then your html should be like this:
Quote:
<ul>
<li><a href="#">» Home</a></li>
<li><a href="#">» Products</a></li>
<li><a href="#">» Special Offers</a></li>
<li><a href="#">» Newsletter</a></li>
<li><a href="#">» Contact</a></li>
</ul>
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 05:25 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
So how does the HTML for that particular list reference the IDs in the CSS?
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 05:33 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
Aah - scrap that last comment. I get it now, thanks I'll try that now!
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 05:38 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Looks like it's working

The answer is specificity.. #menubox ul targets only the ul in that box and so on.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Last edited by LadynRed; 08-17-2006 at 05:39 PM..
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 06:07 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
That's fantastic - thanks for all your help.

Based on my plans, the design is pretty much finished. Any suggestions on how to improve it, though?
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 06:32 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
I think it'll be fine once you get the rest of the site fleshed out. I presume you'll have some graphics in there, that will help.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 06:34 PM Re: Strange CSS hover behaviour
futurevisions's Avatar
Super Talker

Posts: 102
Location: UK
Trades: 0
Yeah, of course. Thanks for all your help - I'll let you know when it's all finished if you'd like?
futurevisions is offline
Reply With Quote
View Public Profile
 
Old 08-17-2006, 06:38 PM Re: Strange CSS hover behaviour
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Sure, I'd love to see it
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Strange CSS hover behaviour
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.11826 seconds with 12 queries