Patch / A worked CSS width change

Fit the host.
Keep the cap.

Replace a fixed width with a host-relative width and a 480 px maximum.

Two isolated block-box cases.
No actual application is patched.

width-rule.diff / teaching fixture

− width: 480px;

+ width: 100%;

+ max-width: 480px;

unchanged:
box-sizing: border-box;
padding: 24px;
border: 2px solid;

Worked CSS fixture / No actual application or full responsiveness claim1 / 4

Actual isolated CSS boxes / The narrow-host overflow is intentional

Before: 480 px.
In both hosts.

BEFORE / width-relevant CSS

.demo.before {
  box-sizing: border-box;
  width: 480px;
  padding: 24px;
  border: 2px solid;
}

320 px host / 480 px card

Demo card / 480 px outer

Scroll to inspect the 160 px extension →
Focus the box, then use ← / →.

600 px host / 480 px card

Demo card / 480 px outer

Scroll to inspect the 600 px host →
Focus the box, then use ← / →.

Worked CSS fixture / No actual application or full responsiveness claim2 / 4

Same padding, border and box sizing / Only the width rule changes

After: 320 or 480 px.
The host sets the limit.

AFTER / width-relevant CSS

.demo.after {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  border: 2px solid;
}

320 px host / 320 px card

Demo card / 320 px outer

600 px host / 480 px card

Demo card / 480 px outer

Scroll to inspect the 600 px host →
Focus the box, then use ← / →.

Worked CSS fixture / No actual application or full responsiveness claim3 / 4

Two isolated host sizes / Expected outer and content widths

The widths fit.
The review continues.

Host / 320 CSS px

320 px

Outer border box
268 px content width

Host / 600 CSS px

480 px

Outer border box
428 px content width

Content = outer − 48 px padding − 4 px border

These two width cases establish no complete application, content, zoom, interaction, browser or accessibility review.

Property references: MDN / box-sizing · MDN / max-width