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
Johnny Sanchez
20,637 PointsHow float affects neighboring selectors
Hello,
I followed the video closely and my code works correctly. My only question is why <footer> was affected by the float attribute we used in the <ul id="gallery">. I understand that rules "cascade" down, but float was only used in the CSS file for #gallery and as I see the HTML code, I understand <footer> to be separate from the <ul> (but part of the same <div>).
My only explanation for this would be how in the later video, it was later explained how blocked elements push against each other. Having the float on the gallery would then let <footer> push right against it (since we made two columns using float and the last row only continued one list item). Is this a correct train of thought? I just really want to know why <footer> was hanging out with the gallery items! hehe
PS- This is for the "Style the Image Captions" video.
2 Answers
Rich Bagley
25,869 PointsHi Johnny,
I always find the article All About Floats from CSS Tricks useful.
Hope it helps as a quick reference.
-Rich
Johnny Sanchez
20,637 PointsHi Rich,
Thank you for taking the time for your response, the website definitely helped! It makes complete sense to clear the float for the footer, but my question remains: why was the footer required by float to move up, when float was used in the ul in the previous section? Does float apply its requirements to the next section as well?