This is one of those simple css issues that just fries my brain. I think I'm telling my target two things at once but can't be sure.

I have a div with a background image that serves as navigation on this website. Only one of the three main buttons has the drop down suckerfish style navigation functionality. I set the css 'color' property to change the text to white on hover for these, but when you roll over the middle one, About The Fund, it isn't responding ... or is being overridden.

I'm just trying to get the words "About The Fund" to change to white upon hover.

You're not getting it because the structure is different for that item - if you look at the other links, you've got the div & UL inside the <a> element (which, while allowed in HTML5, is clunky and clumsy and not all the browsers support it cleanly..., but for the one you're having an issue with, the <a> is inside the div and ul, so you're structure is completely different, and different rules of specificity will apply.

Just because you place a class/id on an element doesn't mean that is the css which will be applied. Read this thread for more information.

scott1964
—
2013-03-20T19:00:34Z —
#4

I figured it was something like that. I still can't seem to target it correctly. What would be a way to just tell that whole div to change color to whit on hover.

I just tried this:

menu li a:hover {

color:#FFF;

}

But that only works obviously when you roll over the actual anchor. I need it to light up the whole time the button is over it.

DaveMaxwell
—
2013-03-20T19:04:26Z —
#5

This should work, but there might be browser quirks....

#menuli:hover > a, #menu li a:hover { color: #fff; }

scott1964
—
2013-03-20T20:32:10Z —
#6

That definitely is working in all my current browsers. I'd like to better understand why though. It looks like you targeting the same anchor in two different ways simultaneously. I don't see how either of those is making the whole <div> area serve as a hot spot for the rollover ...

While I was checking it in Safari 5.1.5, I noticed that it displays an underline when you hover over those same three links. I tried placing an !important on the text-decoration:none; but that didn't get it. Any idea what I need to tell Safari to get it to knock that crap off?

scott1964
—
2013-03-20T20:38:44Z —
#7

I noticed another anomaly. It only works when you roll up on it from the bottom. If your mouse comes down on the button from the top of the screen it won't change to white until you actual are over the anchor itself.

I'm wondering if there is maybe something I can do in jquery that will override just that one link an make it white on rollover?

scott1964
—
2013-03-20T22:45:28Z —
#8

I don't see why we are even talking about styling anchors. the only element in question here is a div with class .threeNav_pos2_off.

When you roll over that, there is code in place that should be turning that text white. I can't see why it matters that there is extra markup in this div. We seem to be saying with our css: anytime you :hover a div called .threeNav_pos2_off, turn the text white. It seems like it should be more straight forward than this.

DaveMaxwell
—
2013-03-21T12:51:54Z —
#9

scott1964 said:

I don't see why we are even talking about styling anchors. the only element in question here is a div with class .threeNav_pos2_off.

When you roll over that, there is code in place that should be turning that text white. I can't see why it matters that there is extra markup in this div. We seem to be saying with our css: anytime you :hover a div called .threeNav_pos2_off, turn the text white. It seems like it should be more straight forward than this.

See post #2 (and the link I posted there) - you're getting bit by the specificity bug. Even though the item has the class on it, the #menu li a has more hits on that element, which is why it tags them and overrides.

scott1964
—
2013-03-21T15:12:56Z —
#10

Hello. I was asked to code a website that uses a very unconventional style of Nav. I don't think the designer was thinking that everything would one day need to be recreated with HTML and CSS. Anyway, what we have is more like three Nav structures in that there are three separate unordered lists being utilized. One for each button.

Since the outer two don't have drop down suckerfish navs we don't need to worry about those, they function fine. The problem lies with the "About The Fund" button in the middle. The only way I could figure to get a dropdown suckerfish menu working on that was to nest another <ul> within an <li> of a parent list. I realize that this makes this structure unlike the other two in it's markup and that this may be causing some difficulty, but I don't think so since the div I am rolling over is higher up in the markup (meaning less nesting).

What I'd like to see happen is when you rollover the entire div with a class="threeNav_pos2_off" the text would change to white. Again the other two are working fine so you can roll over those to see how the middle button should work. It's just that it will also slide down the suckerfish list. It may look as though this is working, but if you look close you will see that the text only changes to white if you mouse directly over the actual anchor tag. Or, for some reason, if you mouse over the button in an upward direction from the bottom. If you roll into the area from the top, the text stays dark until you encounter the anchor ...

Somewhere in my CSS I must have something that is over riding this effect because the text stays #353535 throughout. I'm using the entire containing div (.threeNav_pos2_off) as my "hotspot" for the hover behavior.

So, what I'd like to understand is how to make that text change it's color to white. Or if worst comes to worst, maybe I need to rebuild this entire thing. Is there a better method for doing a drop down like this when not utilizing the traditional "list" style markup for their navigation.

This question originated in a different post and it was suggested there that specificity is the issue. I think that's true but then would need to target the text in that button in such a "specific" way that it takes precedence over and other styling. How to do that ...

What if I add an ID to that same DIV?

Is this even possible?

DaveMaxwell
—
2013-03-21T16:10:04Z —
#13

scott1964 said:

I see. So then the question becomes, how do I target this text in the "most specific" way possible? I tried adding an ID to that div which should be most specific of all, and that didn't work either.

That's why I pointed you to that other thread in post #2- it specifically deals with this issue (I should know as I started the thread because it didn't make sense to me either). CSS selector Specificity doesn't necessarily work in a logical/programming manner. It's basically a count issue.

abouttheFund or .threeNav_pos2_off will never win because it's only one match on the selector scale.

I read the excellent article. Thank you for posting that. My problem isn't in understanding what's wrong so much anymore as in trying to understand how to fix it. It sounds like I need to code something really convoluted in there like. Why not start at the top of the dom (or thereabouts) if that's the case.

body .threeNavStructure threeNav_pos2_off:hover

But that doesn't work.

| scott

DaveMaxwell
—
2013-03-21T18:17:39Z —
#15

scott1964 said:

I read the excellent article. Thank you for posting that. My problem isn't in understanding what's wrong so much anymore as in trying to understand how to fix it. It sounds like I need to code something really convoluted in there like. Why not start at the top of the dom (or thereabouts) if that's the case.

body .threeNavStructure threeNav_pos2_off:hover

But that doesn't work.

| scott

I'll be honest, I'd rework that whole navigation - it's a lot more complicated than it needs to be:

Then, I'd style the un-ordered list. Float the li elements, setting a common width and background-image to them. Then you can set the font-color on the hover like you had earlier.

scott1964
—
2013-03-21T18:21:50Z —
#16

It's just complicated because that's the only way I could figure to make it work. So your suggesting I treat the <ul> as though it's the containing <div>? Just eliminate the whole <div> all together? Or is the structure you suggest to be nested inside the <div> I had earlier?

Never would have thought of that, but I'm game for anything and need to get this working.

DaveMaxwell
—
2013-03-21T18:47:26Z —
#17

scott1964 said:

It's just complicated because that's the only way I could figure to make it work. So your suggesting I treat the <ul> as though it's the containing <div>? Just eliminate the whole <div> all together? Or is the structure you suggest to be nested inside the <div> I had earlier?

Never would have thought of that, but I'm game for anything and need to get this working.

That's how I'd handle it - try to simplify the structure and the styling, and get rid of the extra cruff....unless @Paul_O_B has a better approach....

scott1964
—
2013-03-21T20:08:38Z —
#18

Are you sure you can execute all of this in a list? Seems like list abuse ...

They are floating - you just need to add a margin-top to the a element (I used em, but you can pixel it out if you really want to): #primaryNavigationa{ display:block; text-decoration:none; margin-top: 2.25em; }