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 "<body>" or with other attributes, such as "<body text="#000000">."

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: <body text="#000000" bgcolor="blue"> or <body text="#000000" bgcolor="#0000FF">

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

More Articles

Photo Credits