Results 1 to 6 of 6

Thread: Shouldn't this be blue?

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default Shouldn't this be blue?

    Shouldn't the middle text "#00ffff" here be blue?
    Code:
    <html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <HTML>
    <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <style type="text/css">
    a.w:link {
    color:blue;
    text-decoration: none;
    }
    a.w:visited {
    color:blue;
    text-decoration: none;
    }
    a.w:hover {
    color:blue;
    text-decoration: none;
    }
    
    </style>
    </head><body>
    <div style='float:right;font:16px;font-family:Courier;text-align:right;border: black 2px solid;padding:12px;'>
    <a class='w'><font style='color:#00ffff;'>aqua</font> #00ffff <font style='background-color:00ffff;'>sample </font></a>
    </div>
    
    </body>
    </html>
    Last edited by james438; 06-06-2011 at 01:23 PM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Try chaging 'font' to 'span'

    <span style='color:#00ffff;'>aqua</span>
    instead of
    <font style='color:#00ffff;'>aqua</font>
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I made the change, which was probably needed, but I am still having trouble getting the text: #00ffff; to be blue when the mouse is not hovering over the text.

    EDIT: It seems I need to use href, but the problem is that I do not want the link to go anywhere. There is some javascript involved that will change the text of the links in a div. It works fine, but when the page first loads the color is always black.
    Last edited by james438; 06-06-2011 at 11:56 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    what about using <a href='#' onclick='return false;' class='w'>?
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. The Following User Says Thank You to Beverleyh For This Useful Post:

    james438 (06-06-2011)

  6. #5
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Awesome, that works great! Thanks
    To choose the lesser of two evils is still to choose evil. My personal site

  7. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That works when javascript is enabled. If clicked it does nothing. Without javascript enabled clicking it can make the page reload. At the very least it will append # to the URL in the address bar and in the location object.

    If you use:

    Code:
    <a href='javascript:void(0);' onclick='return false;' class='w'>
    It will do absolutely nothing with or without javascript enabled.

    However, the css :hover pseudo-class works with any element, except in IE 6 and less where an anchor link is required. The above will fix it for IE 6 and less. But there are (depending upon the situation) other ways. You cannot nest one anchor link inside another. If what you're doing requires that, you must use an alternate method.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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