By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,730 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,730 IT Pros & Developers. It's quick & easy.

css hover inside html tags

P: 6
Hi, i have a little problem. I can't make it work:
Expand|Select|Wrap|Line Numbers
  1. <a href="blabla.php" style="hover:color:red;">blablabla</a>
How to type this hover property inside html tag correctly?
Yes I know how it works in stylesheets but in this case I must use it without stylesheets.

Thanks in advance.
Jan 2 '09 #1
Share this Question
Share on Google+
4 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
@rotorio
I am not sure if you can actually do it inline like that, but you could do one of two things:

1. Add your style definition in the head element of the html document.
2. Use the "onmouseover" attribute to set the color.

If someone knows if it can be done inline, great, personally, I never put style inline, it does not belong there.

If you can change the HTML file, why can't you specify an external style sheet and do it there? Just wondering.

Regards,

Jeff
Jan 2 '09 #2

P: 6
It works with all the other css styles. I just need it:)

An example of random css styles inside html tag, try it. It works.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <p style="color: red; font-weight: bold; margin-left: 50px;">Some words</p>
  4. </body>
  5. </html>
Jan 2 '09 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
@rotorio
I know how to do style's inside of the HTML element, they are called inline styles. But, since the hover is typically a class of the element itself (I think class is the right term), I don't see how you could define it inline.

Again, is there any issue with defining it within the head element above? That would be the place to define a hover if you ask me.

Regards,

Jeff
Jan 2 '09 #4

Dormilich
Expert Mod 5K+
P: 8,639
@numberwhun
note: it's called pseudo-class.
Jan 2 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.