Skip to navigation

Repeating background images

Using the background-repeat property.


<!DOCTYPE html>
	<meta charset="utf-8">
		body {
			font: 14px courier;
			background: #fff;
			color: #000;
			margin: 0;
			padding: 10px;
		p {
			background-color: #ccc;
			background-image: url("/examples/images/opacityBg.gif");
			margin: 10px;
			width: 300px;
			height: 300px;
			float: left;
			text-align: center;
		code {
			background: white;
			padding: 0 15px 2px;

		#p1 {
			background-repeat: repeat;
		#p2 {
			background-repeat: no-repeat;
		#p3 {
			background-repeat: repeat-x;
		#p4 {
			background-repeat: repeat-y;
		#p5 {
			background-repeat: space;
		#p6 {
			background-repeat: round;

		#borderCollie a {
			display: block;
			height: 300px;
			background: white url("") center no-repeat;
			text-indent: -999em;
	<p id="p1"><code>background-repeat: repeat;</code></p>
	<p id="p2"><code>background-repeat: no-repeat;</code></p>
	<p id="p3"><code>background-repeat: repeat-x;</code></p>
	<p id="p4"><code>background-repeat: repeat-y;</code></p>
	<p id="p5"><code>background-repeat: space;</code></p>
	<p id="p6"><code>background-repeat: round;</code></p>

	<!-- Link back to HTML Dog: -->
	<p id="borderCollie"><a href=""><img src="" alt="HTML Dog"></a></p>


View original