Skip to content

CSS code snippet – How to remember psudoelements vs pesudo classes?

/*
Pseudo classes:
• Selects actual elements (e.g. p or div) 
• Based on some condition that is probably not part of the HTML DOM
	• e.g if the user is hovering over it (:hover)
• But sometimes it is stuff that would just be hard to calculate
	• e.g. the fist child 

Pseudo elements 
• Select elements that are *not* part of the DOM
• There is no corrisponding tag to be found
	• e.g. p::first-line creates an imaginary tag
	that has everything in the first line in it
*/

See also  CSS code snippet - How to use gradient as text color?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.