Connecting Tech Pros Worldwide Help | Site Map

css hover inside html tags

  #1  
Old January 2nd, 2009, 03:22 AM
Newbie
 
Join Date: Dec 2008
Posts: 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.
  #2  
Old January 2nd, 2009, 03:52 AM
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,543

re: css hover inside html tags


Quote:
Originally Posted by rotorio View Post
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.
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
  #3  
Old January 2nd, 2009, 04:57 AM
Newbie
 
Join Date: Dec 2008
Posts: 6

re: css hover inside html tags


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>
  #4  
Old January 2nd, 2009, 06:14 AM
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,543

re: css hover inside html tags


Quote:
Originally Posted by rotorio View Post
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>
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
  #5  
Old January 2nd, 2009, 10:23 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,486
Provided Answers: 9

re: css hover inside html tags


Quote:
Originally Posted by numberwhun View Post
But, since the hover is typically a class of the element itself (I think class is the right term)
note: it's called pseudo-class.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
css conflicting with named anchor tags azjudd answers 8 October 7th, 2009 03:15 PM
Trying to persuade CSS images to line up horizontally Stan The Man answers 16 July 2nd, 2008 06:45 PM
style lost when html placed in td tags. Obantec Support answers 1 February 2nd, 2006 02:05 PM
Horizontal shifting on hover inside DIV metalseb answers 5 July 20th, 2005 11:17 PM