How to set the tiling mode for html background images

青灯夜游
Release: 2023-01-06 11:16:26
Original
12331 people have browsed it

In HTML, you can use the background-repeat attribute to set the tiling method of the background image; when the attribute value is set to "repeat", it can be tiled vertically and horizontally, and when "repeat-x" is used, it can be tiled vertically and horizontally. Horizontal tiles, "repeat-y" can tile vertically, "no-repeat" can not tile.

How to set the tiling mode for html background images

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

htmlBackground image setting tiling method

<!DOCTYPE html>
<html>
	<head>

		<style type="text/css">
			div{
				border: 1px solid #000fff;
				height: 200px;
				background-image: url(img/1.jpg);
				margin-bottom:10px ;
			}
			#content1 {
				background-repeat: repeat;
			}
			#content2 {
				background-repeat: repeat-x;
			}
			#content3 {
				background-repeat: repeat-y;
			}
			#content4 {
				background-repeat: no-repeat;
			}
		</style>
	</head>
	<body>
		<div id="content1"></div>
		<div id="content2"></div>
		<div id="content3"></div>
		<div id="content4"></div>
	</body>

	</html>
Copy after login

Rendering:

How to set the tiling mode for html background images

Description:

The background-repeat attribute sets whether and how to repeat the background image and defines the tiling mode of the image.

By default, the background image repeats horizontally and vertically.

Attribute value:

Value Description
repeat default. The background image will repeat vertically and horizontally.
repeat-x The background image will repeat horizontally.
repeat-y The background image will repeat vertically.
no-repeat The background image will only be displayed once.

(Learning video sharing: css video tutorial)

The above is the detailed content of How to set the tiling mode for html background images. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!