Home>Article>Web Front-end> How to set background color in html? Detailed analysis of HTML background color code
This article usesHTMLcode and CSS style code to show you how to set the background color of HTML. There is also an introduction on how to setbackground imagelater. I hope it will be helpful to everyone, let’s take a look at this article now
First of all, let’s take a look at setting the background color in HTML:
us First, set a background color. Set the background color in the body tag and let's see the effect:
PHP中文网 这是PHP中文网
The background color is set to black. Can you think of the effect of displaying it in the browser?
Yes, this is the effect. Nothing can be seen. Let’s see if we can set the font to a color and see if it can be displayed:
这是PHP中文网
Now let’s take a look at the effect:
Is it obvious that adding a color to the font can display the text, but there are still two words that have not been added color, so it still cannot be displayed.
Now let’s take a look at how to create a text background:
这是PHP中文网
The font tag no longer works at this time, so we decisively use css styles to change it. Background color, as you can see, this is a simple css style that only sets a background color.
Let’s take a look at the effect displayed in the browser:
Of course, you can also use pictures as background images. Let’s take a look at the effect examples:
This is a picture copied from the Internet, and the effect is still very good Obviously, let’s look at the example now:PHP中文网 这是PHP中文网
HTML Learning Manualcolumn. If you have any questions, you can leave a message below.
【Editor's Recommendation】How to set spaces in HTML paragraph elements? Summary of HTML space settings
#How to use the big tag in html? Usage examples of html big tag
The above is the detailed content of How to set background color in html? Detailed analysis of HTML background color code. For more information, please follow other related articles on the PHP Chinese website!