HighDots Forums  

Image background color wrong on N7.1 - Help?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Image background color wrong on N7.1 - Help? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Beall
 
Posts: n/a

Default Image background color wrong on N7.1 - Help? - 08-15-2003 , 12:23 PM






I'm displaying an image that is also a link against a black background.
In Netscape 7.1, the current background color is displayed as a
horizontal bar below the image. This allows :hover effects that change
the background color to have a visible effect, as this bar changes
color. By default, it appears that the color is inherited from the body
color, i.e. with no link style applied, the bar is black, and invisible
against the background.

BUT, I want a different background color for TEXT links, so I specified
something like:
A:link { background-color: red ; } [Color chosen to
illustrate problem...]
On N 7.1 the expected red bar now appears below images, BUT I wanted
that background color only for TEXT links, so I attempt to override the
style above with:
A IMG {background-color: black ; }
which has no effect. I refine that to:
A:link IMG {background-color: black ; }
A:visited IMG {background-color: black ; }
and that has no effect either. The bar is still red.

All style blocks appear in the order shown above, i.e. the non-IMG
blocks appear first.

Testcase at http://pages.prodigy.net/chris_beall.../linktest.html

Am I doing something wrong, or is Netscape 7.1?

Chris Beall




Reply With Quote
  #2  
Old   
Els
 
Posts: n/a

Default Re: Image background color wrong on N7.1 - Help? - 08-15-2003 , 03:17 PM







"Chris Beall" <Chris_Beall (AT) prodigy (DOT) net> schreef in bericht
news:fG8%a.449$F82.45 (AT) newssvr32 (DOT) news.prodigy.com...
Quote:
I'm displaying an image that is also a link against a black
background.
In Netscape 7.1, the current background color is displayed
as a horizontal bar below the image. This allows :hover
effects that change the background color to have a visible
effect, as this bar changes color. By default, it appears that
the color is inherited from the body color, i.e. with no link
style applied, the bar is black, and invisible against the
background.

BUT, I want a different background color for TEXT links,
so I specified something like:
/snip/

Quote:
Testcase at
http://pages.prodigy.net/chris_beall.../linktest.html

Am I doing something wrong, or is Netscape 7.1?
I'm relatively new to this, so if I'm giving wrong info, anyone,
please correct me:
The problem is not the background of the image, I guess it's black. (I
would have to check that with a transparant image :-)).
The problem is the bar below the image, which is not the background of
the image!
You just have to get rid of that bar, this will solve your problem,
right?
So, have a read at
http://devedge.netscape.com/viewsource/2002/img-table/ and notice,
that adding display: block to your images, works outside tables as
well :-)
In your example code:

A:link IMG {
display: block;
background-color: black ;
border-style: none ;
}
A:visited IMG {
display: block;
background-color: black ;
border-style: none ;
}

Hope this helps,

sincerely,
Els




Reply With Quote
  #3  
Old   
Chris Beall
 
Posts: n/a

Default Re: Image background color wrong on N7.1 - Help? - 08-15-2003 , 04:11 PM



"Els" <els.aNOSPAMPLEASE (AT) tiscali (DOT) nl.invalid> wrote

Quote:
"Chris Beall" <Chris_Beall (AT) prodigy (DOT) net> schreef in bericht
news:fG8%a.449$F82.45 (AT) newssvr32 (DOT) news.prodigy.com...
I'm displaying an image that is also a link against a black
background.
In Netscape 7.1, the current background color is displayed
as a horizontal bar below the image. This allows :hover
effects that change the background color to have a visible
effect, as this bar changes color. By default, it appears that
the color is inherited from the body color, i.e. with no link
style applied, the bar is black, and invisible against the
background.

BUT, I want a different background color for TEXT links,
so I specified something like:

/snip/

Testcase at
http://pages.prodigy.net/chris_beall.../linktest.html

Am I doing something wrong, or is Netscape 7.1?

I'm relatively new to this, so if I'm giving wrong info, anyone,
please correct me:
The problem is not the background of the image, I guess it's black. (I
would have to check that with a transparant image :-)).
The problem is the bar below the image, which is not the background of
the image!
You just have to get rid of that bar, this will solve your problem,
right?
So, have a read at
http://devedge.netscape.com/viewsource/2002/img-table/ and notice,
that adding display: block to your images, works outside tables as
well :-)
In your example code:

A:link IMG {
display: block;
background-color: black ;
border-style: none ;
}
A:visited IMG {
display: block;
background-color: black ;
border-style: none ;
}
Els,

OK, I first tested this by adding:
A IMG { display:block;}
which is a little heavy-handed, but got rid of the bar, which, thanks to
your reference, I now know is descender space on an inline object.
BUT eliminating the descender space also eliminates the hover effect.
I'm still contemplating whether I want to do that or not, but suppose I
wanted to keep it?

Next I removed the above line and added
display: block ;
to both the
A:link IMG
A:visited IMG
styles. That had exactly the same effect, since converting the image to
a block eliminates the descender space and the :hover background has no
effect.

To counteract that, I added:
display: inline ;
to the a:hover, but that had no effect. Of course, the CSS2 spec says,
"User agents are not required to reflow a currently displayed document
due to pseudo-class transitions." so there's a loophole for that one.
Adding the descender space would potentially require reflow of
everything lower on the page.

Which kinda brings me back to the original question:
Why isn't
A:visited
overridden by
A:visited IMG
when they appear in that order, by Netscape 7.1?

Referring to http://www.w3.org/TR/REC-CSS2/cascade.html#specificity, it
appears that the first of these has a specificity of 11, while the
second has a specificity of 12, which wins.

Chris Beall





Reply With Quote
  #4  
Old   
Els
 
Posts: n/a

Default Re: Image background color wrong on N7.1 - Help? - 08-16-2003 , 01:21 PM



Chris Beall wrote:

Quote:
"Els" <els.aNOSPAMPLEASE (AT) tiscali (DOT) nl.invalid> wrote in message
news:bhjf5s$rm$1 (AT) reader1 (DOT) tiscali.nl...

"Chris Beall" <Chris_Beall (AT) prodigy (DOT) net> schreef in bericht
news:fG8%a.449$F82.45 (AT) newssvr32 (DOT) news.prodigy.com...


Testcase at

http://pages.prodigy.net/chris_beall.../linktest.html

Am I doing something wrong, or is Netscape 7.1?

I'm relatively new to this, so if I'm giving wrong info, anyone,
please correct me:
The problem is not the background of the image, I guess it's black. (I
would have to check that with a transparant image :-)).
The problem is the bar below the image, which is not the background of
the image!
You just have to get rid of that bar, this will solve your problem,
right?
So, have a read at
http://devedge.netscape.com/viewsource/2002/img-table/ and notice,
that adding display: block to your images, works outside tables as
well :-)
In your example code:

A:link IMG {
display: block;
background-color: black ;
border-style: none ;
}
A:visited IMG {
display: block;
background-color: black ;
border-style: none ;
}


Els,

OK, I first tested this by adding:
A IMG { display:block;}
which is a little heavy-handed, but got rid of the bar, which, thanks to
your reference, I now know is descender space on an inline object.
BUT eliminating the descender space also eliminates the hover effect.
Sorry, but I don't understand which hover effect
you are talking about; if the background color is
effected by the hovering, you won't be able to see
that. _if_ you mean the background of the image,
that is...

If you want a hover effect like a border on the
image, try:

a:link {text-decoration: none;
color: red;
}

a:visited {text-decoration: none;
color: blue;
}

a:hover {text-decoration: none;
color: green;
}

a:link img{border-color: black;
border-width: 5px;
}

a:visited img{border-color: red;
border-width: 5px;
}

a:hover img{border-color: white;
border-width: 5px;
}

I put my test on
http://home.tiscali.nl/~elizabeth/test/test4.html,
so you can see if that's what you wanted for a
hover-effect.
BTW: no display: block involved...
I couldn't reproduce the 'bar' that was below the
image anymore, so I compared and compared again
and I found it: if you put text-decoration: none
in your img styles, the bar (which seems to be a
link underline!) disappears!

So, back to your hover effect: is the a.m. example
what you want?

Sincerely,
Els



Reply With Quote
  #5  
Old   
Mark Cunningham
 
Posts: n/a

Default Re: Image background color wrong on N7.1 - Help? - 08-17-2003 , 03:04 PM



Chris Beall wrote:
Quote:
I'm displaying an image that is also a link against a black background.
In Netscape 7.1, the current background color is displayed as a
horizontal bar below the image. This allows :hover effects that change
the background color to have a visible effect, as this bar changes
color. By default, it appears that the color is inherited from the body
color, i.e. with no link style applied, the bar is black, and invisible
against the background.

BUT, I want a different background color for TEXT links, so I specified
something like:
A:link { background-color: red ; } [Color chosen to
illustrate problem...]
On N 7.1 the expected red bar now appears below images, BUT I wanted
that background color only for TEXT links, so I attempt to override the
style above with:
A IMG {background-color: black ; }
which has no effect. I refine that to:
A:link IMG {background-color: black ; }
A:visited IMG {background-color: black ; }
and that has no effect either. The bar is still red.

All style blocks appear in the order shown above, i.e. the non-IMG
blocks appear first.

Testcase at http://pages.prodigy.net/chris_beall.../linktest.html

Am I doing something wrong, or is Netscape 7.1?

Chris Beall



How about using classes to address each type of link? I played with it a
little bit, see the attached link. You'll need to modify to fit your
specific needs of course, but it should get the idea across.
http://bellsouthpwp.net/m/a/macunni/sandbox/link.htm


--

Mark Cunningham
http://bellsouthpwp.net/m/a/macunni/




Reply With Quote
  #6  
Old   
Chris Beall
 
Posts: n/a

Default Re: Image background color wrong on N7.1 - Help? - 08-17-2003 , 07:44 PM



"Mark Cunningham" <macunni (AT) REMOVETOEMAILnetscape (DOT) net> wrote

Quote:
Chris Beall wrote:
I'm displaying an image that is also a link against a black
background.
In Netscape 7.1, the current background color is displayed as a
horizontal bar below the image. This allows :hover effects that
change
the background color to have a visible effect, as this bar changes
color. By default, it appears that the color is inherited from the
body
color, i.e. with no link style applied, the bar is black, and
invisible
against the background.

BUT, I want a different background color for TEXT links, so I
specified
(snip)
Quote:
How about using classes to address each type of link? I played with it
a
little bit, see the attached link. You'll need to modify to fit your
specific needs of course, but it should get the idea across.
http://bellsouthpwp.net/m/a/macunni/sandbox/link.htm
Mark,

That technique (using a border-bottom for the :hover highlight) works
for both IE and Netscape.

Thanks,
Chris Beall




Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.