Coding task · HTML and CSS course · Module 3: CSS Basics

Class and ID Selectors

In Ancient Egypt, there were titles (pharaoh, priest - many people) and unique names (Ramesses II - one person). CSS works similarly! CLASSES (class) are groups of elements with a shared style - we use a dot .pharaoh. IDs are unique identifiers for a single element - we use a hash #ramessesII.

Task

Create an Egyptian hierarchy with 5 <div> elements: one with id='pharaoh' (Ramesses II), three with class='priest' (three priests), and one with class='scribe' (scribe). In CSS: #pharaoh {background: gold; font-size: 24px;}, .priest {background: #87CEEB; color: #003049; padding: 15px;}, .scribe {background: #D2B48C; font-style: italic;}.