Tuesday 10 September 2013

CSS classes selecter [class*=“span”] [class^="classname"][class$="classname"]

CSS classes selecter [class*=“span”] [class^="classname"][class$="classname"] examples below;
.show-grid [class*="span"] {
    background-color: #eee;
    text-align: center;
    border-radius: 3px;
    min-height: 30px;
    line-height: 30px;
}
It's an attribute wildcard selector. In the sample you've given, it looks for any child element under.show-grid that has a class that CONTAINS span.
So would select the  element in this example:
< div class="show-grid">
     class="span6">Blah blah
< /div>
You can also do searches for 'begins with...'
div[class^="something"] { }
which would work on something like this:-
< div class="something-else-class">< /div>
and 'ends with...'
div[class$="something"] { }
which would work on
< div class="you-are-something">< /div>

No comments:

Post a Comment

Please post any queries and comments here.