CSS-Selectors specification

Discussion in 'CSS' started by boba5555, Jul 24, 2008.

  1. #1
    Dear,
    I need CSS selector specification, but I couldn't find it. Can someone help me and give appropriate reference? For example, is CSS like
    *.in3 *.in4 i *.in5 *in6.in7 i.inner1{
      /* some properties */
    }
    
    Code (markup):
    valid? I am writing parser, so it is not just enough to check in some validator, like W3 has. I tried to find out the answer on http://www.w3.org/TR/REC-CSS2/selector.html, but without success. Maybe some of you can suggest further links/papers...

    Thank you in advance.
     
    boba5555, Jul 24, 2008 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The places I've seen the regular expressions mixed with pieces of things only had them working with some CSS3 browsers.

    This will always work:
    * {
    styles;
    }

    and this:
    #element * {
    styles;
    }

    But for things like filenames that end in stuff, maybe you want something like
    if it's an anchor, use the attribute selector:
    <a href="foo.txt">Foo</a>

    a[href$=".txt"] {
    color: #fc6;
    }

    If it's an element with maybe title text: <p title="document foo.txt">This is the document called foo.txt</p>
    the
    p[title$=.txt] {
    styles;
    }

    that sort of thing.

    Even then, only works on browsers supporting those selectors.

    Maybe you want to read this? Not sure how much it will help you as far as parsers:
    http://www.456bereastreet.com/archive/200601/css_3_selectors_explained/
    but at least the CSS end of things is explained. Not all browsers accept all selectors. Not all selectors are approved yet I don't thing... don't think I've sene anyone using nth-child stuff yet...

    Your link has the CSS2 selectors. Here are the CSS3 ones (still not finished, thus not implemented in many browsers): http://www.w3.org/TR/css3-selectors/
     
    Stomme poes, Jul 24, 2008 IP
  3. boba5555

    boba5555 Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you for the reply, I found useful information, but I still need something like http://bcook.cs.georgiasouthern.edu/windowsce/image49a.gif diagram is, of course, I need that for CSS selector.
     
    boba5555, Jul 24, 2008 IP