. Replace #rrggbb with a hexadecimal color value (for example, #ffffff for white). Save and refresh the page and the background color will update."/> . Replace #rrggbb with a hexadecimal color value (for example, #ffffff for white). Save and refresh the page and the background color will update.">
Home >Web Front-end >HTML Tutorial >How to change the background color of html web page
To change the background color of an HTML page: Open the file you want to change. Add the style attribute to the <body> tag, for example:
. Replace #rrggbb with a hexadecimal color value (for example, #ffffff for white). Save and refresh the page and the background color will update.
HTML web page background color modification guide
To change the background color of an HTML web page, please follow the steps below:
1. Determine the page you want to change
2. Open the HTML file
3. Add <body>
tag style
Add the
style attribute to the tag, as shown below:
<code class="html"><body style="background-color: #rrggbb"></code>
part is a hexadecimal representation of six digits. Customize the color value. For example, white is
#ffffff and black is
#000000.
4. Specify the color value
part with the color value you wish to use for the background color .
5. Save and refresh the page
Sample code:
Sample code to change to blue background:<code class="html"><body style="background-color: #0000ff"></code>Sample code to change to green background:
<code class="html"><body style="background-color: #00ff00"></code>
Other options:
The above is the detailed content of How to change the background color of html web page. For more information, please follow other related articles on the PHP Chinese website!