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

CSS

Explain in your own words what a floated list item is?

Is it an element that is just sitting on a page with no parent?

2 Answers

When you float an element, it still has it's parent element. Floating simply takes the element out of it's normal document flow, similar to absolute positioning. The main difference is, other elements respect the position of a floated element, and wrap around it.

Now, if you float a set of list items, they likely align left to right or right to left; but inside their parent <ul>, So basically you're just moving how your elements are positioned within there container box. Think of it as a pair of cubes in a rectangular box. Originally the rectangle is stood vertically, to stack the cubes up one by one. Once the cubes are floated, the box is now laid horizontally to lay the cubes side by side. Or you can think of the box as just falling down from vertical to horizontal. The box doesn't change. It simply takes the space it took up vertically (say 100px) and changes to take up space horizontally. So what was originally a 100x10 box is now a 10x100 box.

With all that said where the cubes (list items) end up in space is determined by where the box is taken (ul).

If you mean list as in "li" "/li" then its parent element is the "ul". Hence why its important to postion an float the "ul" where you want it before floating list items. Hope this answer helps..