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".
The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.
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!