How to Change Background Color Using HTML Coding

by C. Taylor

If you do not specify a background color on your webpage, a browser will default to white. By specifying a background color, you override this default setting, so you can achieve the look you want. Although there are a variety of ways to change the background color, such as using cascading style sheets, you can use the simple HTML "bgcolor" code to accomplish the same thing.

Step 1

Open your HTML page in a basic text editor, such as Notepad.

Step 2

Locate the top "body" tag, which may appear as "" or with other attributes, such as "."

Step 3

Enter the following code into the "body" tag: bgcolor="COLOR" Replace "COLOR" with the actual color, but keep the quotation marks. You can use the 16 basic colors by name: black, yellow, red, maroon, gray, lime, green, olive, silver, aqua, blue, navy, white, fuchsia, purple and teal. You can also specify advanced colors in hex code, such as "#0000FF" for blue or "#000000" for black. For example, to change the background to blue, the entire body tag might look like: or

Save your changes and upload the HTML page to your Web server to make it active.


  • Don't use excessively bright colors that make reading difficult.
  • Try to make the background and text highly contrasting to improve readability.

Video of the Day

Brought to you by Techwalla
Brought to you by Techwalla

About the Author

This article was written by the It Still Works team, copy edited and fact checked through a multi-point auditing system, in efforts to ensure our readers only receive the best information. To submit your questions or ideas, or to simply learn more about It Still Works, contact us.

More Articles

Photo Credits

  • Comstock/Stockbyte/Getty Images