<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightgray; /* Sets page background */
}
h2 {
background-color: yellow; /* Sets only heading background */
}
</style>
</head>
<body>
<h2>CSS Background Example</h2>
</body>
</html>
Explanation:
- You can style either the entire page (
body
) or specific elements (likeh2
).
Leave a Reply