CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.
A CSS rule consists of a selector and a declaration block. The selector points to the HTML element you want to style.
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p {
font-family: verdana;
font-size: 20px;
}
</style>
</head>
<body>
<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>
</body>
</html>
Take our CSS Tutorial quiz and earn a certificate.