How to set background image in css

王林
Release: 2023-01-06 11:13:11
Original
10125 people have browsed it

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.

How to set background image in css

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:

    php.cn  

Hello World!

Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!