css hover inside html tags

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rotorio
    New Member
    • Dec 2008
    • 6

    css hover inside html tags

    Hi, i have a little problem. I can't make it work:
    Code:
    <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.
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by rotorio
    Hi, i have a little problem. I can't make it work:
    Code:
    <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 "onmouseove r" 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

    Comment

    • rotorio
      New Member
      • Dec 2008
      • 6

      #3
      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.

      Code:
      <html>
      <body>
      <p style="color: red; font-weight: bold; margin-left: 50px;">Some words</p>
      </body>
      </html>

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by rotorio
        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.

        Code:
        <html>
        <body>
        <p style="color: red; font-weight: bold; margin-left: 50px;">Some words</p>
        </body>
        </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

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by numberwhun
          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.

          Comment

          Working...