Home  >  Article  >  Web Front-end  >  How to set the background image not to be tiled in css

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

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-09 17:21:048884browse

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;">

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;">

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!

Statement:
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