Connecting Tech Pros Worldwide Help | Site Map

css hover inside html tags

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 2nd, 2009, 02:22 AM
Newbie
 
Join Date: Dec 2008
Posts: 6
Default css hover inside html tags

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.
Reply
  #2  
Old January 2nd, 2009, 02:52 AM
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,406
Default

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
Reply
  #3  
Old January 2nd, 2009, 03:57 AM
Newbie
 
Join Date: Dec 2008
Posts: 6
Default

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

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
Reply
  #5  
Old January 2nd, 2009, 09:23 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 32
Posts: 2,227
Default

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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.