CSS Attribute selector - Match attribute values that begin with
- by LuckyShot
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 ).