First text formatting of the first paragraph

I am having a problem with changing the format of the first paragraph when I remove the parent div class and put it in the main container class.

Class name 'inside-content'

, when I put it along with the container then it doesn't work, but when I apply it to the immediate parent class it works.

My code:

<div class="container">

<h1> Sample Text</h1>

    <div class="inside-content">
        <p>Our 2011 collection, along with our fully updated range of contract furniture brochures are available to download. For your copy, please click the links shown on the left.</p>
        <p>Our 2011 collection, along with our fully updated rtange of contract furniture brochures are available to download. For your copy, please click the links shown on the left.</p>
    </div>
</div>
<div class="container inside-content">

<h1> Sample Text</h1>

    <p>Our 2011 collection, along with our fully updated range of contract furniture brochures are available to download. For your copy, please click the links shown on the left.</p>
    <p>Our 2011 collection, along with our fully updated rtange of contract furniture brochures are available to download. For your copy, please click the links shown on the left.</p>
</div>

      

The output is here: Demo

Any help is appreciated.

+3


source to share


1 answer


You should use a : pseudo class of the first type instead of: first-child:



.inside-content p:first-of-type {
  /* your style here */
}

      

+3


source







All Articles