← All Exercises

Use Logical Properties for Direction-Agnostic Layout

intermediatecss~15min

Background

Logical properties map to physical sides based on writing mode and direction, so one rule serves both LTR and RTL.

Problem

Style a callout with logical margin, padding, border, and positioning so it mirrors correctly when the document direction switches from left-to-right to right-to-left.

Input

A callout card with an icon and body text.

Output

CSS that uses inline and block axis properties only.

Sample tests

Sample 1

Input: Document direction is ltr
Expected: border-inline-start draws the accent on the left and margin-inline-start indents the body

Sample 2

Input: Document direction is rtl
Expected: the same rules draw the accent on the right without extra overrides

Your solution

Learning objective

Express spacing, borders, and offsets with logical properties so one stylesheet serves every direction.