slides.oddbird.net/workshops/23-smashing-de/4-space/

Distributing Space

slides.oddbird.net/workshops/23-smashing-de/4-space/

@ Smashing Conf Freiburg

Since 2010 Responsive Web Design

  1. Fluid % Images
  2. Fluid % Columns
  3. @media Queries
A wide-screen wireframe with different sizes
A wide-screen wireframe

A holdover From Print Page Description

The % unit Not Actually Fluid

Relative to parent, ignores siblings

Intrinsic Web Design

The responsive web keeps evolving…

  1. Fluid & Fixed
  2. Stages of Squishiness
  3. Truly Two-Dimensional Layouts
  4. Nested Contexts
  5. Expand & Contract Content
  6. Media Queries, As Needed

Content-Out Elements Sharing Space

use grid for layout-in

.default-values {
flex-direction: row; /* column[-reverse] */
flex-wrap: nowrap; /* wrap | wrap-reverse */
}

Flex Items flex-grow: 1

Distribution of Available Space

Flex Items flex-shrink: 1

Distribution of Unavailable Space

Flex Items flex-basis: auto

The ideal starting width, before flexing

Four Flex Shorthand Values

initial | auto | none | <grow>

Initial Shrink, If Necessary

Same as 0 1 auto

Share Space Equally

Same as <grow> 1 0

Box Alignment

currently in flexbox & grid…

Inline Axis justify-*

justify-content | justify-items | justify-self

Block Axis align-*

align-content | align-items | align-self

Shorthand place-*

place-content | place-items | place-self

Positional Values

start | end | center

Baseline Values

baseline | first baseline | last baseline

Distributed Values

stretch | space-between | space-around | space-evenly

Real Gutters*

row-gap | column-gap | gap

Authors must use order and the grid-placement properties only for visual, not logical, reordering of content.

Grid Specification

Use ordering To Improve Readability

Always check your tab-order…

  1. Start with structured & accessible HTML
  2. Create a responsive & responsible layout
  3. If you re-order, consider updating the DOM

Viewport Relative Units

vw/vi | vh/vb | vmin | vmax

Responsive Type

font-size: calc(1em + 2vw)

Breaking Out

margin-inline: calc(50% - 50vw)

Small Viewport Units

svw/svi | svh/svb | svmin | svmax

Great for… Full(ish)-height sections

Large Viewport Units

lvw/lvi | lvh/lvb | lvmin | lvmax

Dynamic Viewport Units

dvw/dvi | dvh/dvb | dvmin | dvmax

Comparison Functions

min(), max(), and clamp()

Min and Max Multiple Calculations

min(1em + 1vw, 2em, 15%) /* use smallest */
max(10 * (1vw + 1vh) / 2, 1em) /* use largest */

Nested Calculations

max(1.5em, min(1em + 1vw, 3em))

clamp(<min>, <dynamic>, <max>)

clamp(1em, 1em + 2vw, 5em)

🙅🏻‍♀️ Not Allowed

min(min-content, auto)

Multicolumn columns: 5 10em;

column-count | column-width