HTML and CSS Reference
Wait a sec. Before you get way into
solving that problem, I have to ask, why
did we have to go to all this trouble of
using a margin? Why don't we just set
the width of the main area? Wouldn't
that do the same thing?
That sounds good…until you try it.
The problem with setting a width on both the
content area and the sidebar is that this doesn't
allow the page to expand and contract correctly
because both have fixed widths. Check the screen-
shots below that show how it works (or rather,
But this is good. You're thinking in the right ways,
and a little later in the chapter we're going to come
back to this idea when we talk about “liquid versus
frozen” layouts. There are ways to make your idea
work if we lock a few other things down first.
And when the browser window is made
small, the two start to overlap.
When the browser is wide, the
two totally separate.