Sizing and Positioning Page Elements
IN THIS CHAPTER
Wrapping your head around the CSS box model
Setting the sizes of page elements
Encrusting elements with padding, borders, and margins
Letting elements float where they may
Positioning elements exactly where you want them
Every element in web design is a rectangular box. This was my ah-ha moment that helped me really start to understand CSS-based web design and accomplish the layouts I wanted to accomplish.
— CHRIS COYIER
I’m not going to lie to you: When you’re just getting started with CSS, the elements on the page will sometimes seem to defy your every command. Like surly teenagers, they ignore your best advice and refuse to understand that you are — or you are supposed to be — the boss of them. Okay, I did lie to you a little: That can happen to even the most experienced web coders. Why the attitude? Because although web browsers are fine pieces of software for getting around the web, by default they’re not very ...