Submit Your Article Forum Rules

Results 1 to 10 of 10

Thread: CSS hover links

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Posts
    123

    CSS hover links

    I have often seen sites that have different hover effect for links: some have underline and other links in the site have underline and overline.

    How is it that there can be more than one hover effect and how can I go about doing it?

    Thanks!

  2. #2
    WebProWorld MVP mikmik's Avatar
    Join Date
    Aug 2003
    Posts
    1,557
    Might be with border-top using a:hover, along with text-decoration:underline.
    Can you show an example?
    Babies don't need a vacation, but I still see them at the beach... it pisses me off! I'll go over to a little baby and say 'What are you doing here? You haven't worked a day in your life!'
    Steven Wright

  3. #3
    Senior Member
    Join Date
    Jan 2004
    Posts
    123
    OK...... on Webproworld:

    The forum links at the top of each page have a hover underline; and the link hover for the newsletter has no underlines

  4. #4
    WebProWorld MVP mikmik's Avatar
    Join Date
    Aug 2003
    Posts
    1,557
    Didn't have far to go!

    They probably used two sperate classes as 'selectors' something like this:

    .newslinks a:link, a:visited {text-decoration:underline;}

    .newslinks a:hover, a:active{text-decoration:none;}

    then for each link - ( I will have to use some '*' symbols to stop the examples from turning into real links!)
    <*a class="newslinks" href="**">Page One</*a>


    Good reference site, this link to relevent page, use links at top to find 'index'
    http://www.blooberry.com/indexdot/cs.../selectors.htm
    Babies don't need a vacation, but I still see them at the beach... it pisses me off! I'll go over to a little baby and say 'What are you doing here? You haven't worked a day in your life!'
    Steven Wright

  5. #5
    Senior Member splinter's Avatar
    Join Date
    Jul 2003
    Posts
    118
    You need to give the links classes (and if you want, ID's). On one of my sites I have declared this as the defualt style for my links:

    Code:
    a:Link, a:Active, a:Visited { 
    text-decoration: none;
    }
    
    a:Hover { 
    text-decoration: none;
    background-color: #999999;
    color: #FFFFFF;
    border: 1px #666666 solid;
    padding: 0px;
    height: auto; 
    }
    
    a { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 12px; 
    font-style: normal; 
    font-weight: bold;
    color: #6699CC;
    padding: 1px;
    }
    I don't want this for all the links though. This is the code for some other links:

    Code:
    #leftcol .fnav a {
    background-color: #FFFFFF;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    }
    
    #leftcol .fnav a:Hover { 
    color: #6699CC;
    text-decoration: underline;
    border: 0px;
    }
    #leftcol is the ID name I use for that area of the page (called by <div id="leftcol">) and .fnav is the class (I use other styles of links within the leftcol ID). The a means those styles apply to all the anchor tags and a:hover is what happens when the links are hovered over.

    I hope you understood that. If not, I'm sure I'll be able to explain what you don't understand (or someone else could answer of course :P).

  6. #6
    Senior Member
    Join Date
    Jan 2004
    Posts
    123
    so i can put different hover colors for different things?

    If it has a:link can I specify the color of that specific link color?

  7. #7
    Senior Member splinter's Avatar
    Join Date
    Jul 2003
    Posts
    118
    Use this:

    Code:
    .link1 {
    color: #[colour];
    }
    .link2 (
    color: #[colour];
    }
    etc. etc.
    and then the HTML code:


  8. #8
    Senior Member
    Join Date
    Jan 2004
    Posts
    123
    is it possible for me to make each link with its link color and hover color in each piece? eg:

    .link1 {
    color: #[colour];
    a:hover:#[hover colour]
    }
    .link2 (
    color: #[colour];
    a:hover: #[hover colour]
    }

  9. #9
    Senior Member splinter's Avatar
    Join Date
    Jul 2003
    Posts
    118
    You'll need to do this:

    Code:
    .link1 {
    color: #[colour];
    }
    .link1:hover {
    color: #[colour];
    }
    etc. etc.
    And you use the same HTML.

  10. #10
    Senior Member
    Join Date
    Jan 2004
    Posts
    123
    Yeah... the second one works correctly! Thanks a lot!

Similar Threads

  1. Whatever:Hover doesn't work in IE7
    By trancehead in forum Graphics & Design Discussion Forum
    Replies: 8
    Last Post: 11-12-2008, 07:32 PM
  2. IE Hover
    By PARoss in forum Web Programming Discussion Forum
    Replies: 10
    Last Post: 05-18-2007, 04:37 AM
  3. Hover over Images
    By JuniorOnline in forum Web Programming Discussion Forum
    Replies: 2
    Last Post: 03-30-2006, 07:42 AM
  4. CSS HOVER-IE
    By candlese in forum Graphics & Design Discussion Forum
    Replies: 3
    Last Post: 12-10-2005, 09:17 AM
  5. Hover Images
    By WiseWizards in forum Graphics & Design Discussion Forum
    Replies: 5
    Last Post: 06-19-2004, 01:09 AM

Posting Permissions

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