CSS Layout

Key Concepts in Positioning Elements

Building Blocks CSS treats each HTML element as if it is in its own box. This box will either be a block-level box or an inline box. Containing Elements If one block-level element sits inside another block-level element then the outer box is known as the containing or parent element.

block-level elements

clearing floats

clear

The clear property allows you to say that no element (within the same containing element) should touch the left or right-hand sides of a box. It can take the following values:

  1. define grid container element (parent) -> display: grid
  2. set its column and row sizes -> grid-template-columns and grid-template-rows
  3. place grid items (children) into the grid -> grid-column and grid-row

Terminology

  1. grid container
  2. grid item
  3. grid line = The dividing lines that make up the structure of the grid.
  4. grid track = column or row
  5. grid cell = a single “unit” of the grid.
  6. grid area = The total space surrounded by four grid lines. Can contain any number of cells.