具有相同名称的类? [英] Classes with the same name?

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

问题描述

在同一样式表中使用同名的几个类

有什么问题吗?类似......


div.pagedown {

保证金:20px 0px 20px 0px;

border-top:1px solid #caa;

border-left:1px solid #caa;

宽度:450px;

}


img.pagedown {

保证金:0px 8px 0px 8px;

border-width:0;

}


a.pagedown {

颜色:#903;

}


thx,


--williamc

Is there anything wrong with having several classes with the same name
in the same style sheet? Something like...

div.pagedown {
margin: 20px 0px 20px 0px;
border-top: 1px solid #caa;
border-left: 1px solid #caa;
width: 450px;
}

img.pagedown {
margin: 0px 8px 0px 8px;
border-width: 0;
}

a.pagedown {
color: #903;
}

thx,

--williamc

推荐答案

williamc写道:
williamc wrote:
是否有在同一样式表中有几个同名的课程有什么问题吗?
div.pagedown {
img.pagedown {
a.pagedown {
Is there anything wrong with having several classes with the same name
in the same style sheet? div.pagedown {
img.pagedown {
a.pagedown {




你不可能有多个班级一样的名字。你_can_有多个

样式,选择器匹配同一个类(这就是你所拥有的
以上)。


- -

David Dorward http://dorward.me.uk/


Thx。我纠正了。而且作为一种风格问题,由于这些都是一起使用的,所以将它们全部称为pagedown是有道理的。

只是想知道其他人是什么做...


--williamc

David Dorward写道:
Thx. I stand corrected. And as a matter of style, since these are all
used together, it makes sense to me to have them all called "pagedown".
Just wondered what other people do...

--williamc
David Dorward wrote:

williamc写道:

williamc wrote:
在同一样式表中有几个同名的类是否有什么问题?
Is there anything wrong with having several classes with the same name
in the same style sheet?


div.pagedown {
img.pagedown {
a.pagedown {
div.pagedown {
img.pagedown {
a.pagedown {



你不能拥有多个同名的课程。你_can_有多个
样式,选择器匹配同一个类(这就是你上面的内容)。

-
David Dorward http://dorward.me.uk/



2003年9月20日星期六15:05:44 +0100,David Dorward写道:
On Sat, 20 Sep 2003 15:05:44 +0100, David Dorward wrote:
williamc写道:
williamc wrote:
在同一样式表中使用同名的几个类是否有什么问题?
Is there anything wrong with having several classes with the same name
in the same style sheet?


div.pagedown {
img.pagedown {
a.pagedown {
div.pagedown {
img.pagedown {
a.pagedown {



你不能有多个同名的班级。你_can_有多种
样式,选择器匹配同一个类(这就是你上面的内容)。



You can''t have multiple classes with the same name. You _can_ have multiple
styles with selectors that match the same class (which is what you have
above).




嗯......我想类和选择器是一样的。一个类

如:


..classname {};


是根元素的选择器,不是吗?


此外,我认为你可以将一个类/选择器分成多个

定义,例如:


img.classname {position:absolute};

img.somethingelse {...);

img.classname {background-color:000} ;



Hmm.. I thought that classes and selectors were the same thing. A class
such as:

..classname {};

is a selector on the root element, is it not?

Further, I thought you could break up a class/selector into multiple
definitions, such as:

img.classname {position:absolute};
img.somethingelse {...);
img.classname {background-color:000};


这篇关于具有相同名称的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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