What is the diffrence between pseudo elements and pseudo classes in CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the diffrence between pseudo elements and pseudo classes in CSS?

&in pseudo elements even if you remove one double colon it still works nicely..... example: (element::before)(element:before)

19th Apr 2019, 5:41 PM
khalil Saghiri
khalil Saghiri - avatar
2 Answers
+ 4
▶What are Pseudo-classes? ✴ A pseudo-class is used to define a special state of an element. For example, it can be used to: ✴ Style an element when a user mouses over it ✴ Style visited and unvisited links differently ✴ Style an element when it gets focus https://www.w3schools.com/css/css_pseudo_classes.asp ▶What are Pseudo-Elements? ✴ A CSS pseudo-element is used to style specified parts of an element. For example, it can be used to: ✴ Style the first letter, or line, of an element ✴ Insert content before, or after, the content of an element https://www.w3schools.com/css/css_pseudo_elements.asp 🚩 IMPORTANT Notice the double colon notation - ::first-line versus :first-line The double colon replaced the single-colon notation for pseudo-elements in CSS3. This was an attempt from W3C to distinguish between pseudo-classes and pseudo-elements.
19th Apr 2019, 8:02 PM
Robin R.
Robin R. - avatar
0
Thank You
20th Apr 2019, 7:09 AM
khalil Saghiri
khalil Saghiri - avatar