简体   繁体   中英

h1 tag inside div affecting all

I am trying to style headers inside a specific div. Problem is, it affects all headers in the page even those who are styled differently in another div.

My code that is causing the problem:

.container .guide-item .content h1, h2, h3, h4, h5 {
    margin-top: 20px;
    padding: 5px;
    color: #e1bb34;
    font-family: 'Lato', sans-serif;
}

It is even overriding this:

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

Your selector rule is incorrect. It should be:

.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
{}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM