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!
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

charles liscomb
2,074 PointsAccordion not working
Hi, I cant seem to get the accordion to work. Here's my code
<!doctype html>
<html lang="en">
<head>
<title>Pure CSS Accordion</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="accordian.css"/>
</head>
<body>
<div class="tab-group">
<div class="tab">
<input id="tab-one" type="radio" name="tabs"/>
<label for="tab-one">Lable One</label>
<div class="tab-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="tab">
<input id="tab-two" type="radio" name="tabs"/>
<label for="tab-two">Lable Two</label>
<div class="tab-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="tab">
<input id="tab-three" type="radio" name="tabs"/>
<label for="tab-three">Lable Three</label>
<div class="tab-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="tab">
<input id="tab-four" type="radio" name="tabs"/>
<label for="tab-four">Lable Four</label>
<div class="tab-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
</body>
</html>
.tab-group {
margin:0 auto;
max-width: 40em;
width: 100%;
}
.tab {
position: relative;
width: 100%;
}
.tab input {
position: absolute;
left: 0;
top: 0;
z-index: -999;
}
.tab label {
background: #72d2c6;
color: #fff;
display: block;
font-weight: bold;
line-height: 3;
padding-left: .5em;
margin-bottom: .5em;
transition: letter-spacing .55s;
}
.tab input: focus + label,
.tab label: hover {
background: #85d8ce;
letter-spacing: 1px;
}
.tab-content {
max-height: 0;
overflow: hidden;
transition: all .35s;
}
.tab-content p {
margin: 1em 0;
}
.tab input: checked ~ .tab-content {
max-height: 6.25em;
}
1 Answer

Alex Gervais
5,290 PointsYou forgot to close 4 of your
elements.
Add
</div>
</div>
</div>
right above your
tag.