如何为类中的类设置css?

pro*_*eek 0 html css css-selectors

使用此HTML代码.

<div class="noote">
    <p class="first admonition-title">Noote</p>
    <p class="last">Let's noote.</p>
</div>
Run Code Online (Sandbox Code Playgroud)

如何用css将Noote的颜色设置为红色?我的意思是,如何用css为它设置(div class ="noote")和(p class ="first")?

amo*_*era 5

试试这个:

/*this will apply for the element with class first 
inside the element with class noot */

.noote .first{    
    color:red;
}

/* If you wanted to apply a rule for both individually
you can do: */

.noote, .first{    
    border:1px solid red;
}
Run Code Online (Sandbox Code Playgroud)