How to change background color of whole page in HTML?

by eric.hamill , in category: HTML/CSS , 2 years ago

How to change background color of whole page in HTML?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by Ekaterina_90 , 2 years ago

@eric.hamill  By using the CSS background-color property, you can change background color of whole page in HTML.


1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
  </head>
  <body style="background-color: pink">
    <h1>How to change background color of whole page in HTML?</h1>
  </body>
</html> 
by trenton_kirlin , 10 months ago

@eric.hamill 

To change background color of the whole page in HTML, you can use the "body" tag with the "bgcolor" attribute. Here is an example:

1
2
3
4
5
6
7
8
  
    Page Title
  
  
    This is a heading
    This is a paragraph.
  


In the example above, the "bgcolor" attribute is set to "#f0f0f0", which is a light gray color. You can replace this value with any other color you want, using either a color name or a hexadecimal code.