如何在CSS中添加特定的类

舒乐32

如果我在div中添加一个CSS类,它将被v-slot-tradeMatrixLayout覆盖。如何在CSS文件中专门指定此类,以便仅调用此类。将tradeMatrixLayout分配给VerticalLayout。

这将在镀铬中进行检查

<div class="v-slot v-slot-tradeMatrixLayout">

这是我的CSS文件

.tradeMatrixLayout{
 margin-left: 15px !important;
}

div如何调用我专门编写的课程?

查韦斯

class属性可以通过使用他们的名字会收到多个CSS类和用空格隔开,因为看到这里对于您的情况,可以将其添加为:

<div class="v-slot tradeMatrixLayout">

在此示例中,您将添加2个类:v-slottradeMatrixLayout

如果v-slot重写了您要设置的内容tradeMatrixLayout,则意味着您必须发挥特异性总之,即使您使用某些规则也比其他规则更重要!important(假设您有3个类使用!important,应该使用哪一个?)。特异性越高,规则就越重要。

下面的选择器类型列表按其特异性增加:

  • 类型选择器(例如h1)和伪元素(例如::: before)。
  • 类选择器(例如.example),属性选择器(例如[type =“ radio”])和伪类(例如:hover)。
  • ID选择器(例如> #example)。

如果您希望它具有更多的特异性,请将CSS更改为:

div.tradeMatrixLayout{
  margin-left: 15px;
}

使用id添加它:

<div id="myDiv" class="v-slot tradeMatrixLayout">

div#myDiv.tradeMatrixLayout{
  margin-left: 15px;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章