When parsing the start tag, the second class
attribute will trigger a duplicate attribute parse error and be ignored.
if there is already an attribute on the token with the exact same name, then this is a duplicate-attribute parse error and the new attribute must be removed from the token.
Consequently only the first class
attribute will be added so the only class that will apply to the div is div-1
and thus only the first ruleset will apply.
Note that you can apply multiple classes to a single element since the class
attribute accepts a space-separated list of classes. In that case, the normal rules for the cascade will apply (with the properties of the second rule-set overriding the duplicate properties of the first because the selectors have equal specificity and so they are applied in order of appearance).
solved Can i give two class attributes to an HTML element. İf so, which effects my page if i write code to both of them?