Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Psuedo class change Link colour must be in head?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26454
    pettisson
    Member

    Simple question really. I want to change colour of the links and of course it’s made by the code we all know about (below).

    But it will only work if I put the code in the html document’s head-section. – When I instead try to add it to the stylesheet in a class like "body " – which is supposed to affect the whole site (all sites not only the index etc. ) – well then it wont work.

    Code:
    a:link {
    color: #999;
    }
    a:visited {
    color: #999;
    }
    a:hover {
    color: #999;
    }
    a:active {
    color: #999;
    }

    Isn’t it possible to add these pseudo classes in the css stylesheet?

    Regards

    #65552
    pettisson
    Member

    I found where the error is – but how do I fix it?

    Look

    Code:
    body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    color: #CCC;
    background-color: #000000;
    a:link {color:#FFFFFF}
    a:visited {color:#FFFFFF}
    a:hover {color:#FFFFFF}
    a:active {color:#FFFFFF}
    }

    I it closes too early! The rule closes itself after a:link {color:#FFFFFF}

    #65580
    pettisson
    Member

    ok :) This is the code in the stylesheet.

    body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    color: #CCC;
    background-color: #000000;
    a:link {color:#FFFFFF}

    a:visited {color:#FFFFFF}
    a:hover {color:#FFFFFF}
    a:active {color:#FFFFFF}

    }

    I’ve now bolded where the rule close itself (The {} are in yellow). It leaves out the red in the rule. But I need it to be a rule for the hole page so I need it in a "body" -class dont I. So how do I rewrite the rule so it closes WITH the pseudo classes in it – and not leaving some out?

    #65577
    pettisson
    Member

    Silly me, awright! Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.