When did browsers start supporting multiple classes for each tag?

You can use more than one css class in an HTML tag in current web browsers, for example:

<div class="style1 style2 style3">foo bar</div> 

This did not always work; with which versions did the main browsers correctly support this feature?

+4
source share
4 answers

@Wayne Kao - IE6 has no problem reading more than one class name in an element and applying styles that apply to each class. It is about creating new styles based on a combination of class names.

 <div class="bold italic">content</div> .bold { font-weight: 800; } .italic { font-style: italic; { 

IE6 applied both bold and italic styles to the div. However, let's say we wanted all the elements in bold and italics to also be purple. In Firefox (or maybe IE7, not sure) we could write something like this:

 .bold.italic { color: purple; } 

This will not work in IE6.

+9
source

I believe that Firefox has always supported this, at least since version 1.5 anyway. IE added full support in v7. IE6 partially supports it, but its pretty buggy, so don't rely on it to work properly.

+2
source

According to blooberry , IE4 and Netscape 4.x do not support this. HTML 4.0 specification says

class = cdata-list [CS]

This attribute assigns a class name or class set names to an element. Any number of elements can be assigned the same name or class names. Multiple class names must be separated by space characters.

+2
source

Obviously, IE 6 does not handle them correctly if you have a CSS selector that contains multiple class names: http://www.ryanbrill.com/archives/multiple-classes-in-ie/

+1
source

Source: https://habr.com/ru/post/1276677/


All Articles