Background Color

<!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 (like h2).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *