具有相同名称的类?

编程入门 行业动态 更新时间:2024-10-26 20:29:15
本文介绍了具有相同名称的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在同一样式表中使用同名的几个类 有什么问题吗?类似...... 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 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 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};

更多推荐

具有相同名称的类?

本文发布于:2023-05-29 21:34:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/353339.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:名称

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!