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.

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: 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.

Tips

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

Photo Credits

  • photo_camera Comstock/Stockbyte/Getty Images