parent child - CSS: Adjacent sibling inside a class -


trying add top-margin adjacent sibling.

<div class="container">   <h2>header 1</h2>   <p>some text , sentences...</p>   <h2>header 2</h2>   <p>some more text , sentences..</p> </div> 

normally accomplish top-margin on "header 2" using css on adjacent siblings.

p + h2{   margin-top: 12px; } 

however, h2 has margin defined via

.container h2{   margin: 24px 0px; } 

how can make adjacent siblings css work while overriding .container h2 css?

.container h2 more specific p + h2 taken consideration. need more specific selector override margin.

this should "more specific" , override:

.container p + h2 {     margin-top: 12px; } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -