How to set the background image not to be tiled in css

醉折花枝作酒筹
Release: 2023-01-04 09:35:57
Original
8930 people have browsed it

Method: 1. Use the background-attachment attribute with the syntax "background-attachment:fixed"; 2. Use the background-repeat attribute with the syntax "background-repeat:no-repeat".

How to set the background image not to be tiled in css

The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.

The background image will not be repeated or tiled. You can set the background like this:

1. In this way, the background image will be fixed and will not be repeated as the page scrolls.

<body style="background-image: url("图片文件地址"); background-attachment: fixed;">
Copy after login

2. To prevent the image from being repeated on any screen size, you can set the background like this (the image is not tiled):

<body style="background-image: url("图片文件地址"); background-repeat:no-repeat;">
Copy after login

Recommended learning: css video tutorial

The above is the detailed content of How to set the background image not to be tiled 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template