How to set up div background Picture by html
This article mainly explains "how to set up div background pictures in html". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to set up div background pictures by html.
Html sets the method of div background picture: 1, use the style attribute of div element, the syntax is ""; 2, add "{background-image:url (picture name);}" style to div element.
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
The method of setting div background Picture by html
1. The syntax for html to add background images to div is as follows:
Put pictures and web pages in a folder, pay attention to the picture suffix, here is .jpg is only suitable for JPG images, other types of pictures change their suffixes.
The code is as follows:
Demo
Output result:
2. You can set the background image by adding the style "{background-image:url (picture name);}" to the div element, as follows:
Demo.ellipse {width: 400pxposition height: 200pxscape backgroundhorse image: url (1115.08.png);}
Output result:
At this point, I believe you have a deeper understanding of "how to set up div background pictures in html". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!