css - Is :last-child:before pseudo selector correct? -


is below css selector correct ?

:last-child:before 

i've never seen way this, works well.

i wonder way correct or not.

yes absolutely correct. selects last-child of given parent , embeds content before element.

for example, want target last-child of ul element , want add arrow before last element.

ul li:last-child:before {     content: "> "; } 

demo


also, inform last-child won't respect type of element, select last-child of parent, regardless of element, if want target specific element last-child it's parent, use last-of-type instead of last-child


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -