css selectors – CSS: Target ONLY first child-element in parent – first-of-type not working

#page-content p:first-of-type {
color: red;
<div id="page-content">
  <div id="summary">
    <p>Some summary (SHOULD NOT BE TARGETED)</p>
  <p>The first paragraph, ONLY THIS should be targeted.</p>
  <p>The second, show me!</p>
  <div class="someclass">
    <p>1st paragraph in .someclass (SHOULD NOT BE TARGETED)</p>
    <p>2nd paragraph in .someclass</p>

Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here