01 / 05
A tag name changes all of them
Put a page together
INPUT · Slides
01 / 05
Write p { color: red; } and every p goes red.
When you want only one paragraph to be red, you reach for a class.
<p>an ordinary paragraph</p><p class="alert">only this one should be red</p>02 / 05
On the CSS side you put a dot . in front of the class name.
class="alert" (no dot).alert (with a dot)That pairing is the basic rule of classes.
<style> .alert { color: red; }</style><p class="alert">Careful!</p>03 / 05
The same class can go on as many elements as you like, and on different tags (p and li) too.
The trick is to make a class per job — "for important bits", "for buttons".
<style> .point { background-color: yellow; }</style><p class="point">an important bit</p><li class="point">this matters too</li>04 / 05
div is just a box with no meaning of its own. You use it to gather several elements into a group.
Put a class on the div and style it, and you can make something that looks like a card.
<div class="profile"> <h2>a name</h2> <p>learning to program</p></div>05 / 05
p { })class="name" / CSS: .name { })divWith those three you can put the style you meant exactly where you meant it.