what is a pseudo element in css code example

Example 1: the syntax of pseudo-class in css

The syntax of pseudo-classes:

selector:pseudo-class {
  	property:value;
}

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.

Example 3: pseudo elements css

psuedo element(An intuitive answer):
							keywords added to selectors (which are followed by 
                            colon ':' or double colon '::') which allow to target
                            specific element (or specific part of element).
example:
 you can style the first letter of a paragraph as->  p:first-letter{/*styles*/}

STRONG NOTE:  Keep in mind that  ::first-line pseudo-element  must be applied
			  to block level (elements which break line on use)
			  elements in order to take effect.

Example 4: What is a pseudo selector?

A pseudo-class is a selector that selects elements that are in a specific state, e.g. they are the first element of their type, or they are being hovered over by the mouse pointer

Example 5: css pseudo elements

h2::first-letter {}
p::first-line {}
p::selection {background-color: red;}
::after / ::before

Tags:

Misc Example