Just for the sake of this (I really do not recommend you to do this), there is another way to do this:
.content[class~="main"] {}
Or:
.main[class~="content"] {}
Link: http://www.w3.org/TR/CSS2/selector.html
E [foo ~ = "warning"] Matches any element E, the value of the attribute "foo" is a list of space-separated values , one of which is exactly equal to "Warning"
Demo: http://jsfiddle.net/eXrSg/
Why is this really useful (at least for IE6):
Since IE6 does not support multiple classes, we cannot use .content.main , but there are some javascript libraries, such as IE-7.js , that activate the attribute selector, but still seem unsuccessful when it comes to multiple classes. I tested this workaround in IE6 with javascript allowing an attribute selector and it is ugly, but it works.
I have yet to find a script that forces IE6 to support multiple class selectors, but has found many that allow attribute selectors. If anyone knows what works, please give me a shout in the comments so I can get rid of this workaround.
Wesley Murch Aug 21 2018-11-11T00: 00Z
source share