CSS类命名不同?

时间:2014-03-14 22:55:59

标签: html css class

我正在使用TN3库(jquery幻灯片放映)并尝试将类名更改为我更容易理解的类名。事情是div中的类名是否与在.css文件中控制它的类名不同?我很困惑,因为我以前从未见过这个?我只在一个div类中命名了与我的css代码中的类相同的名字?示例如下:

<div class="tn3 description">

and in the .css file the class that controls this div is:

.tn3-image-description{Code here}

所以我的问题是一个不同命名的类怎么能工作? 对我来说,我理解以下内容:

<div class="description">
.description{Code here}

有趣并且我很想知道它是如何工作的,因为我之前没有看到这样做过的事情!

2 个答案:

答案 0 :(得分:1)

此div使用多个(2)单独的类:tn3description

同时检查是否在原始css中导入了任何其他CSS文件。这通常使用@import url("another.css");语法完成,因此您可以搜索@import语句。

答案 1 :(得分:1)

类只是条件

<div class="a b"></div>

<style> 
    .a {color:blue;} /*The style only need to match a element with class "a"*/
    .a.b {color:red;}  /*The style need to match a element with class "a" AND "b"*/
</style>

原来.a.b已覆盖.a,而div的文字为红色。

e.g。 2号

<div>
    <div class="c x"></div>
    <div class="c"></div>
    <div class="x"></div>
</div>

使用.c.x {}只会设置"c x"

的样式