什么时候开始的浏览器每个标签支持多类? [英] When did browsers start supporting multiple classes per tag?

查看:109
本文介绍了什么时候开始的浏览器每个标签支持多类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以使用多个CSS类多在当前Web浏览器的HTML标签,例如:

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?

推荐答案

花王 - IE6没有问题读取元素多个类名称,并应用属于每个类样式。什么物品是指基于类名的组合,创造新的风格。

@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将适用这两个粗体和斜体样式的DIV。然而,说我们希望有粗体和斜体类也是紫色的所有元素。在Firefox(或可能IE7,不知道),我们可以这样写:

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;
}

这不会工作在IE6。

That would not work in IE6.

这篇关于什么时候开始的浏览器每个标签支持多类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆