- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JPEG format</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box box1">
<div class="block"></div>
</div>
<div class="box box2">
<div class="block"></div>
</div>
<div class="box box3">
<div class="block"></div>
</div>
</body>
</html>
CSS
.box {
width: 300px;
height: 140px;
margin: 20px auto;
box-shadow: 1px 1px 3px #999999;
}
.box1 {
background-color: #2ecc71;
}
.box2 {
background-color: #f1c40f;
}
.box3 {
background-image: linear-gradient(to bottom, #2ecc71, #f1c40f);
}
.block {
height: 134px;
background-repeat: no-repeat;
background-position: 50% 50%;
}
You’ve gone to a different page
Goalscompleted
0
- First set the background image
cat_cage.jpg
to the elements with the classblock
. - Then assign a different lower quality image
cat_cage_low.jpg
to them.
Comments