How to set the background picture by HTML
This article mainly introduces the relevant knowledge of "how to set the background picture in HTML". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to set the background picture in HTML" can help you solve the problem.
Method 1. Set the background picture in HTML
The background image can be set directly inside the tag in HTML. The specific code is as follows:
If you set the background image directly, the browser will cover the entire screen according to the size of your picture. If you don't want to tile the picture, you need to make additional CSS settings. This method is troublesome.
Method 2: CSS sets the background picture
The way CSS sets the background image is roughly the same as that of HTML. The specific code is as follows:
Body {background: url ("picture address");}
So far, the picture will cover the entire screen over and over again.
We need to add CSS styles for optimization.
Body {background: url (picture address) no-repeat center center fixed; / * compatible browser version * /-webkit-background-size: cover;-o-background-size: cover; background-size: cover } this is the end of the introduction to "how to set up background pictures in HTML". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.