Welcome to the Treehouse Community
Looking to learn something new?
horizontal navigation with floats
"With floats, we don't have to worry about the the extra whitespace that can appear when using inline or inline-block display." "Floated elements will sit adjacent to each other regardless of the HTML whitespace between them."
we never changed the display value of any of the elements we worked with. why are they acting like inline block elements? Im very confused.
Michael Shields12,638 Points
The <a> elements that are descendants of the <h1 class="name"> and the <ul class="main-nav"> elements are declared as block-level display in our style.css file.
When we declare a float value we are manipulating the normal document flow. That floated element now accepts all block-level element values like width, height, padding, and margin, BUT the floated element doesn't exist on it's own line (i.e. doesn't create HTML whitespace before and after the element like a block-level <div> would) and the surrounding content flows around it, behaving like an inline element would.