Day 23: Pseudo Elements
Pseudo Elements :
- Using pseudo-element, we can style certain areas of any element
- It can be utilized, for instance, to:
- For styling initial letter of any element
- Add content either before or after an element's content.
- Syntax :
selectorName::pseudo-elementName {
property: value;
}
- The ::before and ::after Pseudo-element :
- To add content after the content of an element, use the ::after pseudo-element.
- To add content before the content of an element, use the ::before pseudo-element.
- Example :
- Code :
<!DOCTYPE html>
<html>
<head>
<style>
p::before {content: "BEFORE";}
p::after {content: "AFTER";}
</style>
</head>
<body>
<p> paragraph 1 </p>
<p> paragraph 2 </p>
</body>
</html>
Output :
Comments
Post a Comment