SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Multiple Link Styles on One Page

    Hello,

    I am new to this forum and I am just getting started with HTML and CSS. My question is: Is there a way for links on a single page to have different styling using CSS (like different colors for each link, etc.)? It seems like there ought to be a way to do this but I have not been able to figure it out.

    Thanks in advance for your help!
    Stuart

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Give them a class and then you can style links with the class differently from links without the class.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Give them a class and then you can style links with the class differently from links without the class.
    Thanks Stephen - I thought it would be something like that. To style a link in CSS you might have something like:

    a:link {
    color: red;
    }

    What is the proper syntax to put that same thing in a class selector? Would it be something like:
    .linkclass a:link {
    color: gray;
    }

    Stuart

  4. #4
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,025
    Mentioned
    211 Post(s)
    Tagged
    1 Thread(s)
    Thread moved to a more appropiate area


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
  •