- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>A Little More on background-position</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="block block1"></div>
<div class="block block2"></div>
<br>
<div class="block block3"></div>
<div class="block block4"></div>
</body>
</html>
CSS
body {
padding: 10px;
text-align: center;
}
.block {
display: inline-block;
width: 120px;
height: 120px;
margin: 5px;
background-color: #34495e;
background-image: url("logo.svg");
background-repeat: no-repeat;
border-radius: 5px;
box-shadow: 1px 1px 3px #999999;
}
.block1 {
}
.block2 {
}
.block3 {
}
.block4 {
}
You’ve gone to a different page
Goalscompleted
0
Assign the background position for the blocks:
35px 15px
— To the first block,-95px 15px
— To the second block,-20px 50%
— To the third block,100% 50%
— To the fourth block.
Comments