How to make the background image non-tileable with css

WBOY
Release: 2021-12-03 14:38:54
Original
10067 people have browsed it

In CSS, you can use the "background-repeat" attribute to make the background image non-tiled. This attribute is used to set the tiling mode of the background image. You only need to add "background-repeat:no-repeat;" to the element. ” style to prevent the background image from being displayed tiled.

How to make the background image non-tileable with css

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

How to make the background image non-tiled in css

In css, you can use the background-repeat attribute to set the background image to be non-tiled, background-repeat attribute Set whether and how to repeat the background image. By default, the background image repeats horizontally and vertically. The background-repeat attribute defines the tiling mode of the image.

The attribute values ​​​​are as follows:

How to make the background image non-tileable with css

Let’s take a look at the example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    body{ 
background-image: url(1118.02.png);
}</style>
</head>
<body>
    
</body>
</html>
Copy after login

Output result:

How to make the background image non-tileable with css

After adding the non-tiled style:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    body{ 
background-image: url(1118.02.png);
background-repeat: no-repeat;
}</style>
</head>
<body>
</body>
</html>
Copy after login

Output result:

How to make the background image non-tileable with css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to make the background image non-tileable with css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!