Example of HTML code that can be used to change the background color of a webpage


Here is an example of HTML code that can be used to change the background color of a webpage:

<!DOCTYPE html> <html> <head> <style> body { background-color: #colorcode; } </style> </head> <body> <h1>Hello World!</h1> <p>This page has a colored background.</p> </body> </html>

The background color of the page is set in the <style> section, where the body element is selected and its background-color property is set to a specific color value.

You can change the color code to any color you want like for example #000000 for black, #FFFFFF for white and many more.



You can also use the name of the color instead of the color code.

<!DOCTYPE html> <html> <head> <style> body { background-color: red; } </style> </head> <body> <h1>Hello World!</h1> <p>This page has a colored background.</p> </body> </html>

This will also change the background color to Red.