Florian Schaetz wrote:
> I am aware that the whole thing is very likely a criminal abuse of a
> poor, innocent <li> element and I'll surely burn in hell for it, but
> until I find the time to relearn CSS and build the whole thing from
> scratch, I just want it to stop reacting to hover :-)
FWIW: *Without* changing the underlying markup and the rest of the
stylesheet (*strongly* recommended *against*), you need either
#navtrenn:hover {
background-color: transparent !important;
background-image: url(./trennstrich-gr.png) !important;
}
or
#navigation ul li ul li#navtrenn:hover
{
background-color: transparent;
background-image: url(./trennstrich-gr.png);
}
because of
#navigation ul li ul li:hover A,
#navigation ul li ul li:hover,
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
#navigation ul li ul li A:hover
{
color: #ffffff;
text-decoration: none;
background-color: #21361A;
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^ */
background-image: none;
/* ^^^^^^^^^^^^^^^^^^^^^^^ */
}
#navtrenn {
position: absolute;
left: 0px;
top: 4px;
background-image: url(./trennstrich-gr.png);
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
background-repeat: no-repeat;
width: 9px;
height: 396px;
display: block;
}
starting in line 70 of test.css (`./' is superfluous, of course).
A `#navtrenn:hover' selector without `!important' will not suffice because
the original selector has greater specificity [1]:
#navigation ul li ul li:hover
has specificity 0,1,1,4. By contrast,
#navtrenn:hover
has only specificity 0,1,1,0. But
#navigation ul li ul li#navtrenn:hover
has specificity 0,2,1,4 which is greater than 0,1,1,4.
In general, to make exceptions for a specific element, you can either append
`!important' to a declaration or use a selector with greater specificity for
the exception. However, if the relevant original declarations already are
`!important', you have to use a selector with greater specificity *and* to
put `!important' in the declarations for the exception. So use `!important'
sparingly in your stylesheets.
As for asemantic markup, you have been warned. Next time, use a CSS
inspector-editor (every major browser has one *built-in*, try the <F12> key
in most), RTFM, STFW, and try something by yourself first.
PointedEars
___________
[1] <
http://www.w3.org/TR/CSS2/cascade.html#specificity>
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$
8300...@news.demon.co.uk> (2004)