<div class=" foo bar "></div> <style> .foo { color: red; } [class~="bar"] { background: blue; } </style>