- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The background-repeat Property</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="block block1"></div>
<div class="block block2"></div>
<div class="block block3"></div>
<div class="block block4"></div>
</body>
</html>
CSS
body {
padding: 10px;
text-align: center;
}
.block {
display: inline-block;
width: 192px;
height: 192px;
margin: 5px;
border-radius: 5px;
box-shadow: 1px 1px 3px #999999;
}
.block1 {
background-color: #2ecc71;
background-image: url("cat_box.png");
}
.block2 {
background-color: #3498db;
background-image: url("cat_fish.png");
}
.block3 {
background-color: #e74c3c;
background-image: url("cat_drunk.png");
}
.block4 {
background-color: #e67e22;
background-image: url("cat_tied.png");
background-repeat: no-repeat;
}
You’ve gone to a different page
Goalscompleted
0
Assign background repeat mode to the blocks:
- Horizontal repeat – to the first block,
- Vertical repeat – to the second block,
- No repeat – to the third block,
- Repeat in all directions – to the fourth block.
Comments