On 8/1/05, Steve Clay <[EMAIL PROTECTED]> wrote:
> 
> Monday, August 1, 2005, 4:49:35 PM, Lst Recv wrote:
> > Is there a simple way (without having to give each link a class) of
> > using CSS to change the background color on text links but not images?
> 
> CSS can't do it (selectors can't look down the document tree)...
> 
> 
That's no completely correct...CSS, in a way, DOES look at the document 
tree. For instance, when you have a selector like:

ul ul li

isn't that the same as saying "any li that is in a ul that is a child of a 
ul"? ... sorta like traversing the document tree, isn't it (in a certain 
way, I suppose)?

In this particular case, 

Monday, August 1, 2005, 4:49:35 PM, Lst Recv wrote:
> Is there a simple way (without having to give each link a class) of
> using CSS to change the background color on text links but not images?

My suggestion would be this:

--snip--

<style type="text/css">
body {
background-color:#ccc;
}
img {
border:none;
vertical-align:bottom;
}

a:link, a:visited {
background-color:#f00;
}
a:hover {
background-color:#0ff;
}
a img {
background-color:#ff0;
}

--snip--

<a href="#"><img src="empty.gif" width="100" height="100" alt="Transparent 
Gif"><br />Text Link</a>

--snip--

Someone correct me if I'm wrong, but *technically* speaking, I don't think 
inline elements have children, do they? So, for instance, 

a > img 

is wrong unless

a { display:block;}

Then any 'a' can have child elements...

I think i'm starting to go off on a tangent...

Jon
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to