(CSS) 为 Class 设置 Id 如何使用

(CSS) Set Id for Class How to Use

我正在使用 Kendo 网格,我想将字体设置为白色。

当我将此 css 代码设置为布局时,它会影响所有网格。但我想要的只是将白色设置为网格,其 ID 类似于 #grid id no all of them。

.k-grid-header th.k-header>.k-link {
    display: block;
    min-height: 18px;
    line-height: 18px;
    margin: -0.5em -0.6em -0.4em -0.6em;
    padding: .5em .6em .4em .6em;
    overflow: hidden;
    text-overflow: ellipsis;
    **color: white;**
}

如何为特定 ID 设置 class?

这样试试:

#id .yourclass {
color:#fff;
}

或者,如果 CLASS 在 ID

的父级上
.yourclass #id  {
color:#fff;
}

在 HTML 你有圣。像 <div id="yourid" class="k-grid-header"> 和 CSS:

#yourid.k-grid-header th.k-header > .k-link {...}

或者,如果 ID 在 .k-grid-header 的父级上:

<div id="yourid">
    <div class="k-grid-header">
        ...

<style>
     #yourid .k-grid-header th.k-header > .k-link {...}
</style>