CHAPTER 9
Sizing and Positioning with CSS
In this chapter, you learn how to use CSS to size and position elements in your web pages. You work with elements, pseudo-classes, and pseudo-elements; use the :important declaration to override CSS; and control padding, borders, and margins. You fix elements in place, float elements alongside other elements, and create CSS Flexboxes to allocate space dynamically.

Apply Contextual Formatting with Pseudo-Classes
Target Elements Using CSS Combinators
Override CSS by Using the !important Declaration
Understanding the CSS Box Model
Understanding Ways of Sizing Elements
Specify the Size for an Element
Specify Padding and Borders for an Element
Set Margins to Control Element Spacing
Understanding CSS Positioning Essentials
Fix an Element in Place in the Viewport
Float an Element Beside Another Element
Understanding the display Property
Understanding Pseudo-Classes
In Chapter 7, you learned to use CSS classes, selectors that enable you to apply styles to items you mark as belonging to a particular class. For example, if you define a style called .dramatic, you can apply it to different elements by using class statements, such as <p class="dramatic"> ...
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