1

Possible Duplicate:
How to write a:hover in inline CSS?

Using CSS, I want to define a link's style. However, I want to do it in document, instead of defining it as part of the header. Is it possible to define it (including a:hovor, a:visited, etc).

I'm using the tag, and I would like to be able to do

<a style="a:hovor:color:#ffffff"><!-- ... --></a>

or something like that. I'm pretty sure that doesn't work. So how would define that, or can you even?

Community
  • 1
  • 1
Stormswept
  • 374
  • 5
  • 15

3 Answers3

1

You can always apply a CSS style on Mouseover with Javascript/jQuery. With that said, you should really avoid inline styles. Why can't you use a Stylesheet?

Ryan
  • 2,433
  • 5
  • 31
  • 41
1

I'd prefer to give it a class and then define it in a stylesheet, but it's possible with JS/jQuery. http://jsfiddle.net/Sxpkp/

Alex
  • 6,276
  • 2
  • 20
  • 26
1
  1. No, you can't.
  2. Please, if it is possible, refrain from inline styles. They are bad practice.
  3. If you really need to do this inline without stylesheets, you can solve this with javascript:

    <a onmouseover="window.oldlinkcolor=this.style.color;this.style.color='#ffffff';" onmouseout="this.style.color=window.oldlinkcolor;">...</a>

  4. Though, using onmouseover and onmouseout statically like that is also bad practice, but it will solve your issue cross browser.

Xyz
  • 5,955
  • 5
  • 40
  • 58