Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Make text color change when mouse hovers

    Hi, I have a request to make the text color change when the mouse hovers over. I know how to do it on a link, but not on just plain text. Any help is much appreciated. Thanks!

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,930
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Maybe you came across an insufficiency of Internet Explorer 6 that only supports text color change in links but not on plain text (if done with CSS)?

    Usually (in modern browsers) you can make any text/element change colors, for example:
    Code:
    span:hover, p:hover {color: red;}
    #element_id:hover, .classname:hover {background-color: green;}
    The first line makes all text in span and p elements red, the second line changes the background color of elements with a certain ID or class on mouse over.

  • #3
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I apologize for not specifying - We currently do not use CSS, so I'm looking for it in HTML.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,930
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    There’s no way to do it just with HTML. And I strongly recommend to make use of CSS. It’s not hard and it’s the current way (has been for the last 7 years already).

    Basically it works like this:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>title</title>
    <style type="text/css">
    a {color: green;}
    a:hover {color: red;}
    p:hover {color: blue;}
    .important:hover {color: magenta;}
    </style>
    </head>
    
    <body>
      <p>Lorem <a href="#">ipsum</a> dolor sit <span class="important">amet</span>.</p>
    </body>
    </html>

  • #5
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the explanation. I wasn't sure if there was a way to do it at all with HTML.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •