What is this CSS definition?

Discussion in 'HTML' started by Tami Fischer, Aug 16, 2004.

  1. Tami Fischer

    Tami Fischer Guest

    Hello there,


    a[href ^="http:"] {
    background-color: lightgreen;
    }

    a[href ^="http:"]:hover {
    background-color: red;
    }

    a[href ^="http://brahbrah"] {
    background-image: none;
    background-color: trasparent;
    }


    What in the world does "a[....]" mean?
    Is that standard with CSS?



    --
    T. Fischer
     
    Tami Fischer, Aug 16, 2004
    #1
    1. Advertising

  2. Tami Fischer <> wrote:

    > a[href ^="http:"] {
    > background-color: lightgreen;
    > }


    [...]

    > What in the world does "a[....]" mean?
    > Is that standard with CSS?


    It's an attribute selector, see <http://www.w3.org/TR/2001/CR-css3-
    selectors-20011113/#attribute-selectors>

    --
    David Håsäther
     
    David Håsäther, Aug 16, 2004
    #2
    1. Advertising

  3. "David Håsäther" <> wrote:

    >> What in the world does "a[....]" mean?
    >> Is that standard with CSS?

    >
    > It's an attribute selector, see <http://www.w3.org/TR/2001/CR-css3-
    > selectors-20011113/#attribute-selectors>


    So in this case, a[href ^="http:"] is a selector that matches those <a>
    elements that have an href attribute and that attribute's value begins
    with the string "http:".

    And it is not standard CSS - it does not belong to the CSS 2.0
    specification or the CSS 2.1 draft, and CSS 3.0 is just a collection of
    various sketches. Note that the CSS 3.0 Selectors draft is titled
    "W3C Candidate Recommendation 13 November 2001", with text saying:
    "This is still a draft document and may be updated, replaced, or
    obsoleted by other documents at any time. It is inappropriate to cite a
    W3C Candidate Recommendation as other than "work in progress.""

    Actually that draft also says:
    "The duration of Candidate Recommendation is expected to last
    approximately six months (ending May, 2002)."
    (If I remember the W3C policies and process documents correctly, the
    draft should actually have been moved down to a lower - less mature -
    level long ago, since it did not progress to a Proposed Recommendation.)

    Moreover, even the simpler attribute selectors as defined in CSS 2
    have very poor support - IE doesn't get them at all. That's why pragmatic
    authors use lots of classes instead.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Aug 16, 2004
    #3
    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. Martin Nadoll

    doctype definition and css

    Martin Nadoll, Jun 11, 2005, in forum: HTML
    Replies:
    1
    Views:
    672
    Steve Pugh
    Jun 11, 2005
  2. Jianli Shen
    Replies:
    1
    Views:
    621
    Victor Bazarov
    Mar 13, 2005
  3. Ark
    Replies:
    1
    Views:
    445
    Chris Torek
    Aug 7, 2004
  4. Jon Slaughter
    Replies:
    4
    Views:
    466
    Jon Slaughter
    Oct 26, 2005
  5. Pierre Yves
    Replies:
    2
    Views:
    513
    Pierre Yves
    Jan 10, 2008
Loading...

Share This Page