开发者

Simple Nesting Question

开发者 https://www.devze.com 2023-01-19 11:19 出处:网络
I have a a class: .header { background-color: #233574} I want to to st开发者_开发百科yle h1, h2, h3, h4, h5, h6 within my class only. I thought that this was writteng like so:

I have a a class:

.header { background-color: #233574}

I want to to st开发者_开发百科yle h1, h2, h3, h4, h5, h6 within my class only. I thought that this was writteng like so:

.header{}
.header h1 h2 h3 h4 h5 h6 { color: #FFFFFF} //Style these elements within the .header class

<div class="header">
<h1>Header</h1>
</div>

What am I doing wrong? The h elements are still not pickign up the style?


What you're doing will style only h6 tags that are within h5 tags that are within ... and finally nested within .header. If you want to style each heading separately, you need to do something like this:

.header h1, .header h2, .header h3, .header h4, .header h5, .header h6
    { color: #FFFFFF} //Style these elements within the .header class
0

精彩评论

暂无评论...
验证码 换一张
取 消