Html h1标签在div内影响所有

Html h1标签在div内影响所有,html,css,Html,Css,我试图在一个特定的div中设置标题样式。问题是,它会影响页面中的所有标题,即使是在另一个div中设置了不同样式的标题 导致问题的代码: .container .guide-item .content h1, h2, h3, h4, h5 { margin-top: 20px; padding: 5px; color: #e1bb34; font-family: 'Lato', sans-serif; } 它甚至超越了这一点: .container .mainba

我试图在一个特定的div中设置标题样式。问题是,它会影响页面中的所有标题,即使是在另一个div中设置了不同样式的标题

导致问题的代码:

.container .guide-item .content h1, h2, h3, h4, h5 {
    margin-top: 20px;
    padding: 5px;
    color: #e1bb34;
    font-family: 'Lato', sans-serif;
}
它甚至超越了这一点:

.container .mainbar .newsfeed .contents article h4 {
    font-size: 1.6em;
}

您的选择器规则不正确。应该是:

.container .guide-item .content h1,
.container .guide-item .content h2,
.container .guide-item .content h3,
.container .guide-item .content h4,
.container .guide-item .content h5
{}

对每个元素重复整个选择器,逗号分隔规则,而不是标记,因此:
#引导体h1、#引导体h2、#引导体h3、#引导体h4、#引导体h5
是正确的。我怎么能忽略这一点呢。谢谢