SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: css for links

  1. #1
    SitePoint Member
    Join Date
    Dec 2003
    Location
    In the upper level of my brain
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css for links

    Hi,

    In my css file I have

    .controlPanel {
    background: Blue;
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    font: Arial;
    }

    a.controlPanel:active {
    color: Aqua;
    }

    a.controlPanel:link {
    color: Aqua;
    }

    a.controlPanel:visited {
    color: Aqua;
    }

    In my html file I use the class as:

    <div class="controlPanel">
    links and other junk here
    </div>

    but the links remain the default color and fonts in IE. Is there something I'm missing to get the links to display as the css class?

    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your CSS properties for the links are not declared properly. Replace a.controlPanel:link with ".controlPanel a:link". Your anchors do not have the class .controlPanel assigned but are inside a div of this class. Other browsers than IE are a little more tolerant.

  3. #3
    SitePoint Member
    Join Date
    Dec 2003
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In order for the links to get their specific style, you need to identify the class within the <a> as well.

    So like this:

    Code:
    <a class="controlPanel"></a>

  4. #4
    SitePoint Enthusiast Gamblingharry's Avatar
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a.controlPanel:link only applies to <a class="controlPanel"> tags.

    .controlPanel a:link applies to all <a> tags inside a <div class="controlPanel>. This is what you are trying to do, so go with martin's answer. Although SphereS's answer would work to, its using a different method to what you intended.

  5. #5
    SitePoint Member
    Join Date
    Dec 2003
    Location
    In the upper level of my brain
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Makes sense now. Thanks!


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
  •