SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    liv
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple Link Colors

    Is it possible to have the link text be one color and the text-decoration be another color?

    For example, Black text with a red underline?

    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Location
    England
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think you can do that with text-decoration:underline, but instead you can have text-decoration:none and use e.g. border-bottom: 1px solid red to achieve the same effect. Might need to adjust the bottom padding to get it looking ok.

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,331
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    It actually is possible, if you do something like this:

    Code:
    <!DOCTYPE html>
    <head>
    <meta charset="utf-8">
    
    <title>Experiment</title>
    	
    <style type="text/css">
       .underline {color:#ff0000; text-decoration: underline;}
        .text {color:#000000;}
    </style>
    
    </head>
    
    <body>
    
    <h1 class="underline"><span class="text">some text</span></h1> 
    
    </body>
    </html>
    EDIT: or like this for a link:

    Code:
    <!DOCTYPE html>
    <head>
    <meta charset="utf-8">
    
    <title>Experiment</title>
    	
    <style type="text/css">
        .underline {color:#f00; text-decoration: underline;}
        a {color:#000; text-decoration: none;}
        a:hover {color: #00f; text-decoration: none;}
    </style>
    
    </head>
    
    <body>
    
    <p class="underline"><a href="#">some text</a></p> 
    
    </body>
    </html>

  4. #4
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,762
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Woudln't a bottom border suffice? Assuming the link isn't block level
    Always looking for web design/development work.
    http://www.CodeFundamentals.com


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
  •