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.
References
Tips
- Don't use excessively bright colors that make reading difficult.
- Try to make the background and text highly contrasting to improve readability.
Writer Bio
C. Taylor embarked on a professional writing career in 2009 and frequently writes about technology, science, business, finance, martial arts and the great outdoors. He writes for both online and offline publications, including the Journal of Asian Martial Arts, Samsung, Radio Shack, Motley Fool, Chron, Synonym and more. He received a Master of Science degree in wildlife biology from Clemson University and a Bachelor of Arts in biological sciences at College of Charleston. He also holds minors in statistics, physics and visual arts.