I’m having an CSS problem, i need to achieve this
article div#comments-wrapper ul.sub-comment:before {
width:1px;
height:67px;
background-color:#e4e4e4;
position:absolute;
margin-left:-595px;
margin-top:-36px;
content:'';
}
article div#comments-wrapper ul.sub-comment:nth-child(1):before {
height:37px;
margin-top:-6px;
}
but i can’t put two pseudo elements like that, and i’ve tested it (doesn’t work),
also tried some other ways but didn’t manage to figure it out.
:nth-child()doesn’t filter by classes or anything. In your code, your firstul.sub-commentisn’t the very first child in#comments-wrapper, so it doesn’t work.Instead, use this selector technique and invert your
heightandmargin-topstyles as follows:Basically, instead of
:nth-child(1)(or:first-childfor that matter), use a sibling selector with anotherul.sub-commentto apply the original styles to all subsequentul.sub-commentelements after the first one.Updated fiddle (also inverted the
background-colorstyles so the first one remains blue)