两个CSS类。这可能吗? [英] Two CSS Classes. Is this possible?
问题描述
您好,
是否可以将样式应用于具有两个CSS
类的div?
< div class =" A B"> Test 1< / div>
< div class =" A"> Test 2< / div> ;
我想更改第一个div的背景颜色,因为它已经应用了
类A和B.
我需要能够像复合类一样创建......我认为这是不可能的b $ b。只需查看。
谢谢,
Miguel
Hello,
Is it possible to apply a style to a div that has exactly two CSS
Classes?
<div class="A B">Test 1</div>
<div class="A">Test 2</div>
I want to change the background color of the first div because it has
classes A and B applied.
I need to be able to create like a composite class ... I think this is
not possible. Just checking.
Thanks,
Miguel
推荐答案
shapper写道:
shapper wrote:
是否可以将样式应用于具有两个CSS
类的div?
Is it possible to apply a style to a div that has exactly two CSS
Classes?
当然。
Of course.
< div class =" A B"> Test 1< / div>
< div class =" A">测试2< / div>
我想更改背景第一个div的颜色,因为它有应用的A和B类
。
<div class="A B">Test 1</div>
<div class="A">Test 2</div>
I want to change the background color of the first div because it has
classes A and B applied.
有什么问题?您可以使用选择器.A或选择器.B,
甚至选择器div - 或选择器*,将事物带入
极限。 />
What''s the problem? You can use either the selector .A or the selector .B,
or even the selector div - or the selector *, to take things into the
extreme.
我需要能够像复合类一样创建......我认为这不可能是
。只是检查。
I need to be able to create like a composite class ... I think this is
not possible. Just checking.
我认为你并没有真正描述这个问题。我想你的意思是
CSS规则应该_only_适用于同时拥有这两个类的div。
为此,你只需选择器
div.AB
-
Yucca, http://www.cs.tut.fi/~jkorpela/
I think you are not really describing the problem. I guess you mean that the
CSS rules should _only_ apply to a div that has both classes.
For this, you would just the selector
div.A.B
--
Yucca, http://www.cs.tut.fi/~jkorpela/
< br>
shapper写道:
shapper wrote:
您好,
是否可以将样式应用于div有两个CSS
类?
< div class =" A B"> Test 1< / div>
< div class =" A">测试2< / div>
我想更改第一个div的背景颜色,因为它有
应用A类和B类。
Hello,
Is it possible to apply a style to a div that has exactly two CSS
Classes?
<div class="A B">Test 1</div>
<div class="A">Test 2</div>
I want to change the background color of the first div because it has
classes A and B applied.
..AB将使用A类和B类来设置所有元素的样式,但这确实在IE 6.0上不起作用
(尽管它确实如此)在IE 7+上)。
-
注意上面代码中的错误;我只是证明它是正确的,而不是
尝试过它。 - Donald E. Knuth
..A.B will style all elements with both classes A and B, but this does
not work on IE 6.0 (although it does on IE 7+).
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
9月23日,5:22 * pm,Jukka K. Korpela < jkorp ... @ cs.tut.fiwrote:
On Sep 23, 5:22*pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
shapper写道:
shapper wrote:
是吗可以将样式应用于具有两个CSS
类的div?
Is it possible to apply a style to a div that has exactly two CSS
Classes?
当然。
Of course.
< div class =" A B"> Test 1< / DIV>
<div class="A B">Test 1</div>
< div class =" A"> Test 2< / div>
<div class="A">Test 2</div>
我想更改第一个div的背景颜色,因为它已经应用了
类A和B.
I want to change the background color of the first div because it has
classes A and B applied.
有什么问题?您可以使用选择器.A或选择器.B,
甚至选择器div - 或选择器*,将事物带入
极限。 />
What''s the problem? You can use either the selector .A or the selector .B,
or even the selector div - or the selector *, to take things into the
extreme.
我需要能够像复合类一样创建......我认为这不可能是
。只是检查。
I need to be able to create like a composite class ... I think this is
not possible. Just checking.
我认为你并没有真正描述这个问题。我想你的意思是
CSS规则应该_only_适用于同时拥有这两个类的div。
为此,你只需选择器
div.AB
-
Yucca, http://www.cs.tut.fi/~jkorpela/
是的,我的意思是div.AB ......
我不知道如何解释它。
像往常一样,它在IE 6中不起作用...有没有人有一些统计数据
如何使用IE 6?
你还关心IE6吗?只是想知道...
谢谢,
Miguel
Hi,
Yes I meant div.A.B ...
I didn''t know how to explain it.
As usual, it does not work in IE 6 ... Does anyone has some statistics
for how IE 6 is still used?
Do you still care about IE6 or not? Just wondering ...
Thanks,
Miguel
这篇关于两个CSS类。这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!