不止一节课? [英] more than one class?

查看:73
本文介绍了不止一节课?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


道歉,如果这看起来像一个非常基本的问题 - 但是元素

有不止一个类吗?

如果是这样,你如何设置它们?


以及浏览器如何优先考虑另一个类?

解决方案

" toffee" < to **** @toffee.comscars:


道歉,如果这看起来像一个非常基本的问题 - 但可以元素

有多个班级?

如果是这样,你怎么设置它们?



是的,根据DTD,class属性可以有一个以空格分隔的

类名列表。
< blockquote class =post_quotes>
以及浏览器如何优先于某个类而不是另一个?



正常的级联规则适用;在其他条件相同的情况下,以后的款式会覆盖

之前宣布的款式。


sherm--


- <西弗吉尼亚州为西弗吉尼亚人提供的网络托管服务: http:// wv-www .net

Perl中的Cocoa编程: http:// camelbones .sourceforge.net


文章< eo ********** @ news.freedom2surf.net>,

太妃糖 < to **** @toffee.comwrote:


大家好,


道歉,如果这看起来很漂亮基本问题 - 但是一个元素

有不止一个类?

如果是这样,你如何设置它们?



是,< div class =" featureBox minorFeatureBox">


以及浏览器如何优先于某个类而不是另一个?



如果你添加一个id和一个类,id会在任何冲突中胜出。


如果你有一个与两个班级发生冲突,你可能会认为

要么css中的较低级别会赢,要么最后一次提到

html中的一个会赢。


我猜它是css表中最后提到的一个

或头部甚至内联的样式说明。


易于测试。试试吧。


-

dorayme


Scripsit dorayme:


如果添加id和类,则id在任何冲突中都会获胜。



不,它不是。给定< div class =" foo" id =" bar">,如果您将

设置为以下后会发生什么?


..foo {color:red!important; }

#bar {color:black; }


如果你有两个类的冲突,你可能会认为

要么css中的较低级别会赢,要么最后一个提到

html中的一个会赢。



或者您可以检查规格,看看它是不是那样工作。


我猜想



我不会。


易于测试。试试吧。



如果您碰巧在错误的浏览器上试用,请继续关注错误。


-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/


Hi all,

apologies if this seems like a pretty basic question - but can an element
have more than one class?
if so, how do you set them ?

and how does the browser give priority to a class over another ?

解决方案

"toffee" <to****@toffee.comwrites:

apologies if this seems like a pretty basic question - but can an element
have more than one class?
if so, how do you set them ?

Yes, according to the DTD, the class attribute can have a space-separated
list of class names.

and how does the browser give priority to a class over another ?

Normal cascading rules apply; all else being equal, later styles override
those declared earlier.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


In article <eo**********@news.freedom2surf.net>,
"toffee" <to****@toffee.comwrote:

Hi all,

apologies if this seems like a pretty basic question - but can an element
have more than one class?
if so, how do you set them ?

Yes, <div class="featureBox minorFeatureBox">

and how does the browser give priority to a class over another ?

If you add an id as well as a class, the id wins in any clash.

If you have a clash with two classes, you might reason that
either the class lower in the css will win or the last mentioned
one in the html will win.

I will guess that it is the last mentioned one in the css sheet
or style instruction in the head or even inline.

Easy to test. Try it.

--
dorayme


Scripsit dorayme:

If you add an id as well as a class, the id wins in any clash.

No it doesn''t. Given <div class="foo" id="bar">, what happens if you set the
following?

..foo { color: red !important; }
#bar { color: black; }

If you have a clash with two classes, you might reason that
either the class lower in the css will win or the last mentioned
one in the html will win.

Or you might check the specifications and see that it doesn''t work that way.

I will guess

I won''t.

Easy to test. Try it.

And stay tuned to errors if you happened to try it on a faulty browser.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


这篇关于不止一节课?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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