CSS Tutorial · Chapter 1 of 7
CSS Home
Control colors, spacing, and layout with stylesheets.
CSS styles HTML. Keep CSS in style.css and link it from the HTML head.
Try it Yourself loads both the HTML and CSS sample files into the web editor.
CSS starter page
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 {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #f1f5f9;
font-family: Arial, sans-serif;
}
.card {
width: min(420px, 90vw);
padding: 28px;
border-radius: 16px;
background: white;
}
h1 {
margin: 0 0 8px;
color: #0f766e;
}
.muted {
color: #64748b;
}
.primary {
margin-top: 16px;
padding: 10px 16px;
border: 0;
border-radius: 8px;
background: #0f766e;
color: white;
}
Classroom Tips
- Edit style.css to change the look.
- Run the web preview after each change.