Click to See Complete Forum and Search --> : hover color for a single link


supercain
02-02-2009, 11:55 PM
Hi,

i was wondering if there is a way to define the hover link of a link without previously defining a class inside <style></style>. Just like you define the link color by using the style inside de <a> tag.

<a style="color:red" href="whatever.com">example</a>

so i thought that it may be something like this:

<a style="color:red;hover:blue;" href="whatever.com">example</a>

But unfortunately it doesnt work like that.

Thank you.

Fang
02-03-2009, 01:03 AM
The idea never made it past the working draft (http://www.w3.org/TR/css-style-attr.html#examples) stage.

With the separation of presentation and content (http://en.wikipedia.org/wiki/Separation_of_presentation_and_content), adding style in this manner is somewhat redundant.

supercain
02-03-2009, 02:04 AM
So that means is not possible? i dont think is redundant. Its way more practical when you have only a few links with different style attributes like in my case. I find very annoying having to define a separate css code for only one link.

Charles
02-03-2009, 04:25 AM
But you, or your successor, will find it a blessing when you get tired of the design and go for an update.

Fang
02-03-2009, 05:49 AM
Inline :hover is not possible. You may be able to define a descendant, child or adjacent selector (http://www.w3.org/TR/css3-selectors/) in some instances, otherwise define a class or id.
Unfortunatly nth-child type selectors are generally poorly supported.

Charles
02-03-2009, 05:58 AM
Unfortunatly nth-child type selectors are generally poorly supported.Which is just as well. Someday somebody is going to insert a line on that page and then much head scratching would ensue.

Fang
02-03-2009, 06:08 AM
Which is just as well. Someday somebody is going to insert a line on that page and then much head scratching would ensue.Theoretically, with nth-selectors, all elements could be referenced from the html; so you wouldn't need class nor id!!!

Charles
02-03-2009, 06:53 AM
Theoretically, with nth-selectors, all elements could be referenced from the html; so you wouldn't need class nor id!!!But in practice, somebody who is a little unfamiliar with the CSS comes along and edits the HTML, making the nth element the (n+1)th. It's a better practice to set things up so that you can make edits in the HTML without changing the CSS.