Styling Text with the Before Pseudo-element
📖 Scenario: You are creating a simple webpage that shows a list of favorite fruits. You want to add a small decorative symbol before each fruit name to make the list look nicer.
🎯 Goal: Build a webpage with a list of fruits where each fruit name has a star symbol added before it using the CSS ::before pseudo-element.
📋 What You'll Learn
Create an unordered list with three fruit names: Apple, Banana, Cherry
Add a CSS rule that uses the
::before pseudo-element to insert a star symbol (★) before each fruit nameStyle the star symbol with a color of gold and some spacing to the right
Ensure the page uses semantic HTML and the CSS is properly linked or embedded
Make sure the star symbol is accessible and does not interfere with screen readers
💡 Why This Matters
🌍 Real World
Decorative symbols before text are common in menus, lists, and navigation to improve visual appeal and user experience.
💼 Career
Knowing how to use CSS pseudo-elements like ::before is essential for front-end developers to create stylish and accessible web pages.
Progress0 / 4 steps