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 trialColin Sygiel
5,249 PointsWhy does not adding "clearfix" to the html <copyright> solve this problem? It is already defined in the css.
Since clearfix is already defined in the CSS, shouldn't it work the same if it is added to html?
/* Complete the challenge by writing CSS below */
.footer-nav {
float: left;
}
.logo {
float: right;
}
.footer-nav li {
float: left;
}
.clearfix::after {
content: "";
display: table;
clear: both;
}
<!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 class= "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 clearfix">©2015 The Best City.</p>
</footer>
</div>
</body>
</html>
1 Answer
Chris Shaw
26,676 PointsHi Colin,
The last task for this challenge isn't asking for you to use the clearfix
class, but a property applied directly to the .copyright
selector that allows you to ensure it sits below. The property the task is looking for is clear
, see the below link which explains all the use cases for this property.
https://developer.mozilla.org/en/docs/Web/CSS/clear
I won't give the answer the directly, but this task is simple enough that reading the above link will help more than just pasting some code in my answer.
Happy coding!
Colin Sygiel
5,249 PointsColin Sygiel
5,249 PointsBig thanks, Chris. It's my understanding that the clearfix would do the same thing, but the clearboth is what they were asking for.
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsYou're welcome, the difference between the two can be associated with the way
margin
andpadding
work.margin
applies to the outside of an element which relates to the wayclear
works whilepadding
applies to the inside of an element likeclearfix
.Colin Sygiel
5,249 PointsColin Sygiel
5,249 PointsGreat, thanks again Chris! Cheers.