CSS Coding Help

Discussion in 'Web Design and Development' started by jdl8422, Nov 20, 2007.

  1. jdl8422 macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #1
    i have my site set up and I am using an external style sheet. I have attached a photo of what I want the text to look like, but when I at the links it changes it to the default blue color that I do not want. how do I set up multiple link styles or just have a stlye that leaves links like i already have them?
     

    Attached Files:

  2. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #2
    You can style link behaviors with CSS pseudoclasses. For example:

    Code:
    a {
      color: #600;
      text-decoration: none;
    }
    a:hover {
      color: #fff;
      text-decoration: underline;
    }
    
    That will give you red, non-underlined links that turn white and become underlined when you hover over them. You can get more specific with a:link (default link state), a:visited (a link that the user has visited), and a:active (when a link is clicked on). Of course since all your links on your site are unlikely to behave the same way -- your navigation links might be different from inline links in posts -- you'll want to target your CSS.

    Code:
    #main_nav a {
      color: #600;
      text-decoration: none;
    }
    
    ^ That targets only "a" tags inside an element with id="main_nav".
     

Share This Page