ideal identity
ideal identity

Reputation: 71

How to Hide First Item of h3:before

I have multiple H3 headings on a page. I wanted to display a black line before each H3 on the page except the first h3 and I have implemented following rule:

#Webappcontent_2346 > h3:before {
margin: 0 auto;
content: "";
width: 98%;
height: 1px;
border: none;
background: #000;
display: inline-block;
}

This rule displays black line before each h3, however I'm not sure which rule I can use to hide the line before first h3.

Any ideas?

Upvotes: 1

Views: 327

Answers (5)

divy3993
divy3993

Reputation: 5810

The Demo below:

h1:not(:first-child){
    color:red;
}
<div class="abc">
        <h1>Hello</h1>
        <h1>Hello</h1>
        <h1>Hello</h1>
        <h1>Hello</h1>
        <h1>Hello</h1>
</div>

Upvotes: 0

Vicky
Vicky

Reputation: 378

check this demo

#Webappcontent_2346 > h3:first-child:before {display:none}

Upvotes: 0

Tushar Gupta
Tushar Gupta

Reputation: 15923

Try the first-of-type selector

h3:not(:first-of-type)

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172558

You can try this:

h3:not(:first-child)

Upvotes: 1

Pixel
Pixel

Reputation: 1976

You have to use :

#Webappcontent_2346 > h3:not(:first-child) {
   margin: 0 auto;
   content: "";
   width: 98%;
   height: 1px;
   border: none;
   background: #000;
   display: inline-block;
}

Upvotes: 2

Related Questions