CSS validation Q

Discussion in 'HTML' started by Paul F. Johnson, Sep 16, 2003.

  1. Hi,

    I have a style sheet. In one of the definitions, I define the link colours
    via

    a:link {color: red;}

    When I pass this through the validator at w3c, I find that I cannot do
    this. Are the likes of a:link top level (i.e. global) or is there a way
    for a particular definition to have it's own colour for a link?

    TTFN

    Paul
     
    Paul F. Johnson, Sep 16, 2003
    #1
    1. Advertising

  2. Paul F. Johnson

    rf Guest

    "Paul F. Johnson" <> wrote in message
    news:p...
    > Hi,
    >
    > I have a style sheet. In one of the definitions, I define the link colours
    > via
    >
    > a:link {color: red;}


    Perfectly valid. There must be something else wrong.

    > When I pass this through the validator at w3c, I find that I cannot do
    > this. Are the likes of a:link top level (i.e. global) or is there a way
    > for a particular definition to have it's own colour for a link?


    Er, what?

    The URL is now required.

    Cheers
    Richard.
     
    rf, Sep 16, 2003
    #2
    1. Advertising

  3. Paul F. Johnson

    Steve Pugh Guest

    "Paul F. Johnson" <> wrote:


    >I have a style sheet. In one of the definitions, I define the link colours
    >via
    >
    >a:link {color: red;}
    >
    >When I pass this through the validator at w3c, I find that I cannot do
    >this.


    Really? The above is fine, although it will generate a warning - not
    an error - about specifying a background-color with your color. It is
    good practice to specify the two together, just in case a user has a
    stylesheet with a:link {background-color: red;}.

    > Are the likes of a:link top level (i.e. global) or is there a way
    >for a particular definition to have it's own colour for a link?


    a:link refers to all links in the document.

    To refer to specific links either:
    Add a class to the <a> element and use a.classname:link {}
    or
    Add a class to the containing element of the links. e.g. <div
    class="navigation"><a href="foo">bar</a> and use .navigation a:link {}

    If this doesn't cover your problem you really should post a URI so
    that we can check and see exactly what the validator is complaining
    about, etc.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Sep 16, 2003
    #3
  4. Paul F. Johnson wrote:

    > Are the likes of a:link top level (i.e. global)


    Do you mean you are trying to do something like this?

    #sidebar {
    a:link { color: red; }
    }

    If so, then you should look st the CSS specification for an understanding
    of the basic syntax of CSS!

    If refer to all links within the #sidebar, do this:

    #sidebar a:link {
    color: red;
    }

    The only thing that you can "nest" further definitions in is with some of
    the @- rules.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
     
    Toby A Inkster, Sep 16, 2003
    #4
  5. Hi Paul F. Johnson,

    [Tue, 16 Sep 2003 13:46:51 +0100/Paul F. Johnson]
    > Hi,
    >
    > I have a style sheet. In one of the definitions, I define the link colours
    > via
    >
    > a:link {color: red;}
    >
    > When I pass this through the validator at w3c, I find that I cannot do
    > this. Are the likes of a:link top level (i.e. global) or is there a way
    > for a particular definition to have it's own colour for a link?


    It's valid, but you got the warning of not having set a background-
    color (fore-/background should be set together)


    regs
    michael
     
    Michael Weber, Sep 16, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Mackay
    Replies:
    0
    Views:
    2,724
    Colin Mackay
    Jun 25, 2003
  2. Libs
    Replies:
    0
    Views:
    1,558
  3. Colin Basterfield

    Web form validation vs object validation

    Colin Basterfield, Nov 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    447
    Tommy
    Nov 29, 2003
  4. Matt
    Replies:
    14
    Views:
    4,213
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  5. Lucas Tam
    Replies:
    2
    Views:
    1,145
    Lucas Tam
    Feb 26, 2004
Loading...

Share This Page