akirk — 2012-11-21T21:07:43-05:00 — #1
Hi, I'm creating a test site to learn CSS:
I can't figure out why my NAV list on the right is not nested inside the black HEADER. I know I could declare a height on the HEADER so that the NAV appears to be inside the header, but I shouldn't have to do that. Must be something wrong with my CSS. Any suggestions?
ralphm — 2012-11-21T22:38:01-05:00 — #2
Hi akirk. Welcome to the forums.
This is a common issue. The reason is that parent elements don't wrap around floated elements by default. (The floats hang out of the parent unless you force the parent to contain or wrap around them.)
You can easily fix this by adding this to your CSS:
Here is a longer explanation: http://pageaffairs.com/notebook/containing-floats
akirk — 2012-11-21T23:04:21-05:00 — #3
That was extremely helpful. I think I'm going to like it here.
ralphm — 2012-11-21T23:30:49-05:00 — #4
It's a great forum, indeed. I'm pretty sure I've learned more here than from all books, sites and courses put together.