How to Change Background Color Using HTML Coding

By C. Taylor

Simple HTML code can change the background color of your webpage.
i Comstock/Stockbyte/Getty Images

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.

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

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

Enter the following code into the "body" tag:


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:


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