PSEUDO ELEMENTS
Documentation: https://www.w3schools.com/css/css_pseudo_elements.asp
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
SYNTAX
The syntax of pseudo-elements:
::BEFORE
The ::before
pseudo-element can be used to insert some content before the content of an element.
The following example inserts an image before the content of each <h1> element:
Heading 1
::AFTER
The ::after
pseudo-element can be used to insert some content after the content of an element.
The following example inserts an image after the content of each <h1> element:
Heading 1
ALL PSEUDO ELEMENTS
- ::after - Insert something after the content of the selected element
- ::before
- Insert something before the content of the selected element
- ::first-letter - Selects the first letter of each selected element
- ::first-line - Selects the first line of each selected element
- ::selection - Selects the portion of an element that is selected by a user
CUSTOM BULLET POINTS
The ::before
pseudo-element can be used to insert some content before the content of an element.
The following example inserts an image before the content of each <h1> element:
- ::after - Insert something after the content of the selected element
- ::before
- Insert something before the content of the selected element
- ::first-letter - Selects the first letter of each selected element
- ::first-line - Selects the first line of each selected element
- ::selection - Selects the portion of an element that is selected by a user
FONTAWESOME ICONS
By using content and font-family: 'FontAwesome', you can insert icons using pseudo-elements. As these icons are font glyphs they can be style using font properties e.g. color, font-size etc.
Search for relevant icon Unicode: https://fontawesome.com/icons
Note: FontAwesome set in Duda is out of date so some icons will be unavailable or display different icon.
Heading 1
ADD SHAPE TO SELECTED NAV ITEM
By using content and font-family: 'FontAwesome', you can insert icons using pseudo-elements. As these icons are font glyphs they can be style using font properties e.g. color, font-size etc.