问题描述
嗨伙计们,
我在一些页面中发现了这个:
< td style =" border-bottom:1px solid #000000; border-left:1px solid
#000000; background-color:#4080A0; font-weight:bold;颜色:#000000;"
class =" myclass">
我从未见过同一元素中使用的样式和类。
常见吗?哪个胜利?会发生什么?
对于它的价值,类myclass实际上没有被定义。
-
Dan Langille
履历表:
Hi folks,
I found this in some pages:
<td style="border-bottom: 1px solid #000000; border-left: 1px solid
#000000; background-color:#4080A0;font-weight: bold; color: #000000;"
class="myclass">
I''ve never seen both style and class used in the same element. Is the
common? Which wins? What happens?
For what it''s worth, the class myclass was not actually defined.
--
Dan Langille
resume: http://www.langille.org/
推荐答案
样式属性比外部样式表具有更高的特异性。
-
David Dorward
重新设计正在进行中:
微软宣布IE已经死亡(所以升级):
The style attribute has a higher specificity then external style sheets.
--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead
这就是级联的地方。规则发挥作用。 ID比CL $更重,但本地定义的样式比链接更重要
样式表,定义的样式的最后一个实例覆盖以前的
实例等等。
- Richard
This is where the "cascade" rules come into play. IDs have more weight than
CLASSes, but locally-defined styles have more weight than linked
stylesheets, the last instance of style defined overrides a previous
instance, etc., etc.
-- Richard
style属性比外部样式表具有更高的特异性。
The style attribute has a higher specificity then external style sheets.
不一定,ID''在外部样式表中具有比内联样式更高的b $ b特异性。
无头
Not necessarily, ID''s in an external stylesheet have a higher
specificity than an inline style.
Headless
这篇关于在元素中使用样式和类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!