- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The background-position 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");
background-repeat: no-repeat;
}
.block2 {
background-color: #3498db;
background-image: url("cat_fish.png");
background-repeat: no-repeat;
}
.block3 {
background-color: #e74c3c;
background-image: url("cat_drunk.png");
background-repeat: no-repeat;
}
.block4 {
background-color: #e67e22;
background-image: url("cat_tied.png");
background-repeat: no-repeat;
}
You’ve gone to a different page
Goalscompleted
0
Assign the following background positions to the blocks:
50% 50%
— To the first block,100% 0
— To the second block,0 100%
— To the third block,100% 100%
— To the fourth block.
Comments