一次级联几个班级 [英] Cascading several classes at once

查看:67
本文介绍了一次级联几个班级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试组合几个类的属性。这是通过将一个

空格分隔的类定义列表分配给一个元素来完成的。但是,在选择合适的房产时,IE显示了一种优惠价格,我认为这可能是错误的。这就是它的作用:


如果在提供相同属性的样式表中定义了两个类,并且如果将这两个类分配给一个类,则为
单个元素,使用类'的属性的首选项是* * *由元素类定义

设置,而是由样式表中的类定义序列设置。


我认为这会带来很大的灵活性。任何意见?


这是一个例子:


---------------- -

..c1

{颜色:黑色;

}


..c2

{color:red;

}

-----------------

< span class =" c1 c2">这显示为红色。< / span>

< span class =" c2 c1">这也显示红色。< / span>

-----------------

我的意见应该是:

-----------------

< span class =" c1 c2">这显示为红色。< / span>

< span class =" c2 c1">这显示为黑色。< / span>

---------- -------

I try to combine properties of several classes. This is done by assigning a
space separated list of class definitions to an element. However, IE shows a
kind of preference when choosing the right property which I think is
probably wrong. Here''s what it does:

If two classes are defined in a stylesheet providing the same property, and
if these two classes are assigned to one single element, the preference
which class''s property is used is *not* set by the elements class definition
but by the sequence of class definitions in the stylesheet.

I think this takes away much flexibility. Any opinion?

Here''s an example:

-----------------
..c1
{color: black;
}

..c2
{color: red;
}
-----------------
<span class="c1 c2">This is shown red.</span>
<span class="c2 c1">This is also shown red.</span>
-----------------
To my opionion it should be:
-----------------
<span class="c1 c2">This is shown red.</span>
<span class="c2 c1">This is shown black.</span>
-----------------

推荐答案

Axel Dahmen写道:
Axel Dahmen wrote:
我尝试结合属性几节课。这是通过将一个空格分隔的类定义列表分配给一个元素来完成的。
然而,IE在选择合适的
属性时显示了一种偏好,我认为这可能是错误的。这就是它的作用:
I try to combine properties of several classes. This is done by
assigning a space separated list of class definitions to an element.
However, IE shows a kind of preference when choosing the right
property which I think is probably wrong. Here''s what it does:




关于分配给单个

元素的多个类,IE被破坏了!


-

Google Blogoscoped
http://blog.outer-court.com


" Axel Dahmen" <否**** @ NoOneKnows.de>写道:
"Axel Dahmen" <No****@NoOneKnows.de> wrote:
我尝试组合几个类的属性。这是通过将一个
空格分隔的类定义列表分配给一个元素来完成的。但是,在选择合适的属性时,IE显示了一种偏好,我认为这可能是错误的。这就是它的作用:

如果在提供相同属性的样式表中定义了两个类,并且如果将这两个类分配给一个单独的元素,则首选项
使用哪个类的属性*不是由元素类定义设置的,而是由样式表中的类定义序列设置。
I try to combine properties of several classes. This is done by assigning a
space separated list of class definitions to an element. However, IE shows a
kind of preference when choosing the right property which I think is
probably wrong. Here''s what it does:

If two classes are defined in a stylesheet providing the same property, and
if these two classes are assigned to one single element, the preference
which class''s property is used is *not* set by the elements class definition
but by the sequence of class definitions in the stylesheet.




这是正确的行为。


查看
http://www.w3.org/TR/CSS2/cascade.html#specificity


http://www.w3.org/TR/html401 /struct/...tml#adef-class


没有什么可以暗示为

单指定的多个类元素除了具有相同的特异性之外还有因此

标准CSS特异性规则适用,样式表确定

适用。


Steve

-

我的理论给你起见,我的异端邪说你愤怒,

我从不回信,你也不喜欢我的领带。 ; - 医生


Steve Pugh< st *** @ pugh.net> < http://steve.pugh.net/>



That''s correct behaviour.

Check out
http://www.w3.org/TR/CSS2/cascade.html#specificity
and
http://www.w3.org/TR/html401/struct/...tml#adef-class

There''s nothing there to imply that multiple classes specified for a
single element have anything other than equal specificity. Thus the
standard CSS specificity rules apply and the stylesheet determines
which applies.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don''t like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>


你认为向CSS小组提出这样的行为是否值得?

---------------------------

" Steve Pugh" < ST *** @ pugh.net> schrieb im Newsbeitrag

新闻:40 ******************************** @ 4ax.com ...
Do you think it might be worth proposing such behaviour to the CSS group?
---------------------------
"Steve Pugh" <st***@pugh.net> schrieb im Newsbeitrag
news:40********************************@4ax.com...
" Axel Dahmen" <否**** @ NoOneKnows.de>写道:
"Axel Dahmen" <No****@NoOneKnows.de> wrote:
我尝试组合几个类的属性。这是通过将
aspace分隔的类定义列表分配给元素来完成的。但是,IE
在选择合适的房产时显示出一种偏好,我认为这可能是错误的。这就是它的作用:

如果在提供相同属性的样式表中定义了两个类,
并且如果将这两个类分配给一个单独的元素,则首选项
使用哪个类的属性是*不是由元素类
definition设置,而是由样式表中的类定义序列设置。
I try to combine properties of several classes. This is done by assigning aspace separated list of class definitions to an element. However, IE shows akind of preference when choosing the right property which I think is
probably wrong. Here''s what it does:

If two classes are defined in a stylesheet providing the same property, andif these two classes are assigned to one single element, the preference
which class''s property is used is *not* set by the elements class definitionbut by the sequence of class definitions in the stylesheet.



这是正确的行为。

查看
http://www.w3.org/TR/CSS2/cascade.html#specificity

http://www.w3.org/TR/html401/struct/...tml#adef-class

没有什么可以暗示为单个元素指定的多个类具有除了相同特异性之外的任何东西。因此,
标准CSS特异性规则适用,样式表确定适用。

Steve



That''s correct behaviour.

Check out
http://www.w3.org/TR/CSS2/cascade.html#specificity
and
http://www.w3.org/TR/html401/struct/...tml#adef-class

There''s nothing there to imply that multiple classes specified for a
single element have anything other than equal specificity. Thus the
standard CSS specificity rules apply and the stylesheet determines
which applies.

Steve





这篇关于一次级联几个班级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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