- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sprites</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button class="btn btn-add" type="button">
<span class="icon icon-add"></span>
Add
</button>
<button class="btn btn-edit" type="button">
<span class="icon icon-edit"></span>
Edit
</button>
<button class="btn btn-remove" type="button">
<span class="icon icon-remove"></span>
Delete
</button>
<!-- Sprite on dark background -->
<div class="full-sprite"></div>
</body>
</html>
CSS
body {
padding: 20px;
font-family: "Tahoma", sans-serif;
}
.btn {
display: block;
width: 180px;
margin: 20px auto;
padding: 12px;
color: white;
font: inherit;
text-align: left;
border: 0;
background-color: #34495e;
border-radius: 5px;
}
.btn-add {
background-color: #27ae60;
}
.btn-remove {
background-color: #c0392b;
}
.icon {
display: inline-block;
width: 15px;
height: 15px;
margin: 0 5px;
vertical-align: bottom;
background-image: url("bootstrap-sprites.png");
background-repeat: no-repeat;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}
.icon-add {
}
.icon-edit {
}
.icon-remove {
}
.full-sprite {
height: 200px;
margin: 50px auto;
background: #34495e url("bootstrap-sprites.png") no-repeat 50% 50%;
border-radius: 5px;
}
You’ve gone to a different page
Goalscompleted
0
Set the background location:
-407px -96px
— To the element with the classicon-add
,-96px -72px
— To the element with the classicon-edit
,-456px 0
— To the element with the classicon-remove
.
Comments