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

Thread: Css Links

  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Css Links

    question is about CSS and links.

    I can get underline effect, background change, etc by using .a but i need to have more than one sort of link in my page, e.g. menu links cannot have the same effect as links in the main text.

    How do i set up more than two link effects?

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    hi jakenoble,

    you can use classes, like this:
    Code:
    ...css...
    
    a  {
         text-decoration:underline;
         }
    
    a.red  {
         color:red;
         }
    
    a.white   {
         color:white;
         }
    
    ...HTML...
    
    <a href="#">This is a normal, underlined link.</a>
    <a class="red" href="#">This is a red link.</a>
    <a class="white" href="#">This is a white link.</a>
    -Rich

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Code:
    A:link      { ... }
    A:visited { ... }
    A:active  { ... }
    A:hover  { ... } 
    
    A.class1:link      { ... }
    A.class1:visited { ... }
    A.class1:active  { ... }
    A.class1:hover  { ... } 
    
    A.class2:link      { ... }
    A.class2:visited { ... }
    A.class2:active  { ... }
    A.class2:hover  { ... } 
    
    ...
    <a href="page.htm">link 1</a>
    <a href="page2.htm" class="class1">link 2</a>
    <a href="page3.htm" class="class2">link 3</a>

  • #4
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Dover, Delaware
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can also do classes in divisions i.e...


    #header .black {border: 1px dashed black; color: black;}
    #sidebar .black{border: 1px solid black; color: #e0e0e0;}

  • #5
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers guys, that hits the nail right on the head.

    Jake


  •  

    Posting Permissions

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