Describe, using appropriate code examples, how CSS Pseudo Classes and CSS Pseudo Elements work

Example 1: pseudo class css

.element:nth-child(1)
.element:hover
.element:visited

Example 2: pseudo elements css

::after 	Matches a stylable element appearing after the originating element's actual content.
::before 	Matches a stylable element appearing before the originating element's actual content.
::first-letter 	Matches the first letter of the element.
::first-line 	Matches the first line of the containing element.
::grammar-error 	Matches a portion of the document containing a grammar error as flagged by the browser.
::marker 	Matches the marker box of a list item, which typically contains a bullet or number.
::selection 	Matches the portion of the document that has been selected.
::spelling-error 	Matches a portion of the document containing a spelling error as flagged by the browser.

Tags:

Css Example