What is this CSS selector? [class*=”span”]

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 <strong> element in this example:

<div class="show-grid">
    <strong class="span6">Blah blah</strong>
</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>

Good references

Leave a Comment