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
Ashish Mehra
447 PointsClearfix doesn't make any change
I am having issue with my slider when i set it to float the another contents occupy the left over space on the right side.I try to clear that with clearfix set of css but nothing happen. here is the link http://checksite.net23.net/index.html Please help me to overcome from this issue. Thanks
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Ashish,
The clearfix hack is meant to solve a different problem than the one you're having here.
The clearfix hack causes a parent element to contain its floated children instead of collapsing to zero height.
If I understand your problem, you want the elements that come after the slider to clear the slider.
In this case, you can use the clear: left; declaration.
If it's the "Post Advertisement" link that needs to drop below then you can add that declaration to the existing rule.
.addAdv {
clear: left; /* add to your existing declarations */
}
This tells the browser that it should force that element down below any previously floated left items.
Are you planning to have anything to the right of the slider? What's the reason you need to float the slider?
If you don't float the slider then you don't have to worry about clearing the float.
Ashish Mehra
447 PointsAshish Mehra
447 Pointsyes i am going to add some content on right
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsOk, you should be fine with floating that content left. It will still appear on the right side.
But if you need to float it right then change the
clear: leftin .addAdv toclear: both;This way the link will clear both left and right elements. Otherwise your link will be on the left side of your right column if it is longer than the slider.