CSS3 Selectors: Match a substring

This entry is part 17 of 40 in the series CSS3 Selectors


Matches any element E whose attribute attr matches val anywhere within the attribute.

In other words, the string val is matched anywhere in the attribute value.

It is similar to E[attr~=val] above, except that the val can be part of a word. 

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>codecrawl.com : start with</title>
        a[href*='hoo'] {
            color: green;

<a href='http://google.com'>This is to google</a>
<a href='http://yahoo.com'>This is to yahoo</a>

Series Navigation<< CSS3 Selectors: Matches the end of the attribute value
CSS3 Selectors: Pseudo class :hover >>

Leave a comment

Leave a Reply