Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When did browsers start supporting multiple classes per tag?

Tags:

html

browser

css

You can use more than one css class in an HTML tag in current web browsers, e.g.:

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

This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature?

like image 616
David Kolar Avatar asked Dec 10 '22 23:12

David Kolar


2 Answers

@Wayne Kao - IE6 has no problem reading more than one class name on an element, and applying styles that belong to each class. What the article is referring to is creating new styles based on the combination of class names.

<div class="bold italic">content</div>

.bold {
  font-weight: 800;
}

.italic {
  font-style: italic;
{

IE6 would apply both bold and italic styles to the div. However, say we wanted all elements that have bold and italic classes to also be purple. In Firefox (or possibly IE7, not sure), we could write something like this:

.bold.italic {
  color: purple;
}

That would not work in IE6.

like image 61
Bryan M. Avatar answered Mar 03 '23 07:03

Bryan M.


I believe Firefox has always supported this, at least since v1.5 anyway. IE only added full support in v7. IE6 does partially support it, but its pretty buggy, so don't count on it working properly.

like image 25
Nathan Avatar answered Mar 03 '23 09:03

Nathan