The way to set the background image in css is to use the background-image attribute, such as [background-image:url();]. An element's background takes up the full size of the element, including padding and borders, but not margins.
The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.
In CSS we can use the background-image attribute to set a background image for an element. An element's background occupies the entire size of the element, including padding and borders, but not margins.
By default, the background image is placed in the upper left corner of the element and repeats horizontally and vertically.
For example:
Related learning video sharing:css video tutorial
The above is the detailed content of How to set background image in css. For more information, please follow other related articles on the PHP Chinese website!