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 trialTimothy Delaney
2,785 PointsTrying to apply a clearfix to the footer. What am I doing wrong?
???
/* Complete the challenge by writing CSS below */
.clearfix::after {
content: "";
display: table;
clear: both;
}
.footer-nav {
float: left;
}
.logo {
float: right;
}
.footer-nav li {
float: right;
}
<!DOCTYPE html>
<html>
<head>
<title>Getting Started with CSS Layout</title>
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<footer>
<div class=footer clearfix>
<img class="logo" src="city-logo.svg" alt="logo">
<ul class="footer-nav">
<li><a href="#">Ice cream</a></li>
<li><a href="#">Donuts</a></li>
<li><a href="#">Tea</a></li>
<li><a href="#">Coffee</a></li>
</ul>
<p class="copyright">©2015 The Best City.</p>
</footer>
</div>
</body>
</html>
3 Answers
Steven Parker
231,248 PointsYou don't need to add a new div inside the footer, just apply the class directly to the footer element.
And remember to enclose your class name(s) in quotes:
<footer class="clearfix">
edeharrison
Full Stack JavaScript Techdegree Student 11,127 PointsHi Timothy,
In this task, it asks you target the footer tag, not the div with a class of footer. So, in your HTML (don't need to touch your CSS for this one), you need to add a class of "clearfix" to the opening footer tag:
<footer>
You add a class to a tag with this syntax:
<footer class="your-class">
Hope that helps,
Ede
Timothy Delaney
2,785 PointsThanks for your help.
Ryan Peacan
26,764 PointsIt's difficult to tell what you're trying to accomplish due to not knowing what page.css brings to the table, but I did notice some issues with the index.html file, hopefully it helps:
<div class="container">
<footer>
<div class="footer clearfix"> <!-- This line didn't have quotes around the classes -->
<img class="logo" src="city-logo.svg" alt="logo" />
<ul class="footer-nav">
<li><a href="#">Ice cream</a></li>
<li><a href="#">Donuts</a></li>
<li><a href="#">Tea</a></li>
<li><a href="#">Coffee</a></li>
</ul>
<p class="copyright">©2015 The Best City.</p>
</div> <!-- This div wasn't closed. whoops! -->
</footer>
</div>
Timothy Delaney
2,785 PointsTimothy Delaney
2,785 PointsThat did it. Thanks for your help.