SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to apply a class to multiple links..

    Hi there.......
    I was just wondering if it is possible to apply a class to multiple links without having to apply that class to each link....
    for example, I want my footer links to have a different style to all other links, but I want to avoid defining the class for every link....
    thanks in advance...

  2. #2
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can apply style to all the <a> tags inside a class using contextual selectors:
    Code:
    .someclass a
     {
     color:#ffcc00;
     font-family:verdana, arial, sans-serif;
     font-weight:bold;
     text-decoration:none;
     /*etc...*/
     }
    All the <a> tags within the .someclass will inherit the properties.

  3. #3
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    or you can do this:

    a:link.text2 {color:#FFFFFF;]
    a:visited.text2 {color:#FFFFFF;}
    a:active.text2 {color:#FFFFFF;}
    a:hover.text2 {color:#66FF33;}
    a:link {color:#00FF00;}
    a:visited {color:#CCCCCC;}
    a:active {color:#FFFF00;}
    a:hover {color:#FF0000;}
    a:link, a:visited, a:active {text-decoration:none;}


    and on your links use

    <A class=text2 href=""></A>

    for the text 2 type

    and

    <A href=""></A>

    for the rest

    Sarah
    Regular user

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good answer Sarah, but if you read MVD's post again, you'll see that he/she doesn't want to have to define the style for each link.

    MVD, sorry, but if you want two different styles, then ONE set of your HREF tags will have to be defined manually.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    SitePoint Member Enverity's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere, hopefully
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isotope, that was just what I was looking for. I chanced upon this topic and I thought please let someone have an answer...
    Thanks.
    --En
    "It wasn't me."


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
  •