CSS Attribute selector - Match attribute values that begin with

Posted by LuckyShot on Stack Overflow See other posts from Stack Overflow or by LuckyShot
Published on 2010-01-27T16:53:13Z Indexed on 2010/04/01 6:23 UTC
Read the original article Hit count: 582

I am trying to identify all the <UL> that contain a menu list by defining the ID like this:

<ul id="menutop">
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    <li><a href="#">item3</a></li>
</ul>
<ul id="menumain">
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    <li><a href="#">item3</a></li>
</ul>

As per what I understand, I could use:

ul[id|='menu']>li>a {color:#f00;}

(<a> direct child of a <li> direct child of an <ul> that has its id starting with menu) But it doesn't work.

Searching a bit brought me this [question][1] which suggests that ID is an attribute and not a property so I don't get why it isn't working. What am I doing wrong?

Here's a link to the CSS2 Matching attributes and attribute values as per the W3 standards ( http://www.w3.org/TR/CSS2/selector.html#matching-attrs ).

© Stack Overflow or respective owner

Related posts about css

Related posts about firefox