scrimba
Introduction to CSS
CSS Classes & IDs
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

CSS Classes & IDs
AboutCommentsNotes
CSS Classes & IDs
Expand for more info
index.html
run
preview
console
<html>
<head>
<link rel="stylesheet" href="instructor.css">
<link rel="stylesheet" href="index.css">
</head>
<body>
<header>
<h1 class="white">Classes & IDs</h1>
</header>
<main>
<section>
<h3>When should we use classes?</h3>
<p>Here are <b>two</b> rules of thumb</p>
<ul>
<li>When you <b>want to</b> apply the same style to multiple elements</li>
<li>But <b>not all elements</b> of the same name</li>
</ul>
<p>A class can be used on <b>multiple elements</b>, and an element can have <b>multiple classes</b></p>
</section>
<section>
<h3>When should we use IDs?</h3>
<p>Here are <b>two</b> rules of thumb</p>
<ul>
<li>When you <b>don't need to</b> apply the same style to multiple elements</li>
<li>To have a <b>unique</b> selector to a common element.</li>
</ul>
<p>A ID cannot be used on <b>multiple elements</b>, and an element cannot have <b>multiple IDs</b></p>
</section>
</main>
</body>
</html>
Console
index.html
-5:06