给一个元素两个css类 [英] give two css class to the one element

查看:76
本文介绍了给一个元素两个css类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何给一个元素提供两个css类?

这可能吗?

how to give two css class to the one element ?
can this possible ??

推荐答案





是的,这是可能的,只需要在属性中分隔所有类:

Hi,

Yes, that''s possible, just seperate all classes with a space in the class attribute:
<p class="first second third"> ... </p>



在此处阅读更多内容:

< a href =http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm> http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm [< a href =http://webdesign.about.com/od/css/qt/tipcssmulticlas.htmtarget =_ blanktitle =New Window> ^ ]



希望这会有所帮助。


Read more here:
http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm[^]

Hope this helps.


通过在类属性中用空格分隔控件,可以有多个控件类。但你不能拥有任何控件的多个类属性..



例如:1)。两个班级

You can have more than one class for controls by separating them with space inside class attribute. But you cann''t have more than one class attribute to any controls..

Ex: 1). Two classes
<div class="myclass1 mycalss2">content</div>



2)。 N个班级


2). N number of classes

<div class="myclass1 myclass2 myclass3 ... ">content</div>





注意:如果你在两个类中都写了重复样式,它们可能会互相覆盖。所以避免重复相同的样式。



Note: If you written repeating style in both the classes they may get overwrite by each other.. So avoid repeating same styles.


这篇关于给一个元素两个css类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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