Chapter 5
Exploring the CSS Box Model
IN THIS CHAPTER
Wrapping your head around the CSS box model
Giving elements room to breathe with padding
Enclosing elements with borders
Keeping other elements at bay with margins
Setting the width and height of page elements
CSS comes with a huge number of tools and techniques that you can wield to make stubborn page elements behave themselves. Those tools and techniques form the bulk of this book, but just about everything you do as a CSS developer will in some way involve (or be influenced by) the CSS box model, which is the subject you delve into in this chapter. The box model is so fundamental to almost everything in CSS that you should consider this chapter to be the foundation for almost every other CSS topic in the book.
Getting to Know the Box Model
Every web page consists of a series of HTML tags, and each of those tags represents an element on the page. In the strange and geeky world known as Style Sheet Land, each of these elements ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access