CSS Tutorial · Chapter 2 of 7
CSS Intro
Selectors and properties.
A CSS rule has a selector and a declaration block: selector { property: value; }
Class selectors start with a dot, such as .card.
Selector demo
Try it Yourself »
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Tutorial</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section class="card">
<h1>CoderKiosk CSS Lab</h1>
<p class="muted">Style this page using CSS.</p>
<button class="primary">Start Lesson</button>
</section>
</body>
</html>
style.css
body {
font-family: Arial, sans-serif;
background: #eef2ff;
padding: 32px;
}
.card {
background: white;
padding: 24px;
border-radius: 12px;
}
h1 {
color: #3730a3;
}
Classroom Tips
- Match selectors to HTML class names carefully.
- End each declaration with a semicolon.