Objective

How to target elements whose class begins, ends or contains a specific keyword.

Begins with "keyword"

[class^="keyword"] {
    ...
}
div[class^="keyword"] {
    ...
}
p[class^="keyword"] {
    ...
}

Ends with "keyword"

[class$="keyword"] {
    ...
}
div[class$="keyword"] {
    ...
}
p[class$="keyword"] {
    ...
}

Contains "keyword"

[class*="keyword"] {
    ...
}
div[class*="keyword"] {
    ...
}
p[class*="keyword"] {
    ...
}

Comments

  • CSS 3

Sources

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.