Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Rafael Mocelin
Courses Plus Student 3,271 PointsLabel a "box" element without it being an "input"
I am trying to put an icon on top of a box I created so that it is fixed at the top of that box. Any suggestions how to do this? Can't seem to get it right.
Here is my HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="experiment3.css">
<link rel="stylesheet" href="C:\Users\Rafael\Desktop\Treehouse adventure1\font-awesome\css/font-awesome.min.css">
<title>Spazzo</title>
</head>
<body>
<div class="wrap">
<div class="buttons">
<a class="btn" href="#">
<i class="icon-glass"></i></a>
<a class="btn1" href="#">
<i class="icon-food"></i></a>
<a class="btn2" href="#">
<i class="icon-briefcase"></i></a>
<a class="btn3" href="#">
<i class="icon-group"></i></a>
<a class="btn4" href="#">
<i class="icon-music"></i></a>
<a class="btn5" href="#">
<i class="icon-heart"></i></a>
<a class="btn6" href="#">
<i class="icon-camera"></i></a>
<a class="btn7" href="#">
<i class="icon-leaf"></i></a>
</div>
</div>
</body>
</html>
I would like to place an image on top of the .wrap class so that it is fixed on top of it, sort of like a label.
1 Answer
nik
8,925 PointsI think there's a couple ways you can do this. You can either add another div around your wrap or you can make a sub class you can tack onto your wrap if you plan on re-using it.
.wrap {
/* existing code here */
}
.wrap.label {
/* code here with image for label*/
}
<div class="wrap label">
<div class="buttons">
<a class="btn" href="#">
<i class="icon-glass"></i></a>
<a class="btn1" href="#">
<i class="icon-food"></i></a>
<a class="btn2" href="#">
<i class="icon-briefcase"></i></a>
<a class="btn3" href="#">
<i class="icon-group"></i></a>
<a class="btn4" href="#">
<i class="icon-music"></i></a>
<a class="btn5" href="#">
<i class="icon-heart"></i></a>
<a class="btn6" href="#">
<i class="icon-camera"></i></a>
<a class="btn7" href="#">
<i class="icon-leaf"></i></a>
</div>
</div>