CSS Properties: How to set the content property to its default value?
Solution:
HTML Code:
Explanation:
- This HTML document demonstrates how to use the content property in CSS to set the content of a pseudo-element.
- The CSS rule p:before targets the pseudo-element ::before of all <p> elements and sets its content to "Learn -".
- The CSS rule p#w3r:before targets the pseudo-element ::before of <p> elements with the ID "w3r" and sets its content to its default value using content: initial;.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics