CSS reference
Lesser-known CSS properties
Properties that quietly solve real problems but stay off most people's radar. Each one shows the input and a real rendered output, so you see the effect — not just a description.
Layout & box
Properties that shape sizing, alignment, and where elements sit — without a single media query.
writing-mode
DirectionReorients text and layout from horizontal to vertical — or left-to-right. A tiny property that changes the whole composition of a block.
.vertical {
writing-mode: vertical-rl;
letter-spacing: 0.2em;
}
Vertical text runs down the page — no images needed.
aspect-ratio
SizingLocks a box's width to height ratio. Give it one dimension and the other follows automatically — the modern way to reserve video space.
.card {
aspect-ratio: 16 / 9;
background: #eef0ff;
border-radius: 10px;
}
isolation
StackingCreates a fresh stacking context at that element, so absolutely-positioned children and z-index fights are contained inside it instead of leaking outward.
.ui-header {
isolation: isolate;
}
Text & type
Typography properties that polish the details — alignment, case, and spacing — hiding inside the CSS spec.
vertical-align
InlineAmong inline elements, vertical-align shifts alignment relative to the baseline — the culprit when "there's a mysterious gap below my image."
img { vertical-align: middle; }
Text box
vertical-align that box would sit on the baseline.
Try it in the compiler
text-transform
CaseRewrites casing in the browser without touching your HTML — uppercase, lowercase, capitalize, or full-width for CJK.
.title { text-transform: uppercase; }
written in lowercase html
column (multi-column)
Layoutcolumn-count/column-gap flow text into balanced columns — a print-style layout with two lines of CSS.
.cols {
columns: 2;
column-gap: 28px;
}
Long-form text flows naturally from the top of the first column into the second, like a printed magazine. The browser balances the height for you. No flex, no measuring — just declare the column count and let it reflow.
text-wrap
Typetext-wrap: balance evens up the last line of a heading — wrapping balanced lines instead of leaving a single orphan word.
h2 { text-wrap: balance; }
A heading with balanced wrapping sits on nicely
Visual effects
Filters and blends that do real image work in the browser — fading, glows, and color math with one declaration.
mask-image
Graphicsmask-image fades an element out using a gradient's alpha — a soft edge that a plain linear-gradient background can't give you.
.fade {
-webkit-mask-image: linear-gradient(
90deg, #000, #000 55%, transparent);
mask-image: linear-gradient(
90deg, #000, #000 55%, transparent);
}
mix-blend-mode
Graphicsmix-blend-mode blends an element into what's behind it. difference inverts against the backdrop for a striking effect.
.copy { mix-blend-mode: difference; }
filter: drop-shadow()
GraphicsDrops a shadow around the element's actual painted shape (including transparent PNGs and clipped SVG), unlike the rectangular box-shadow.
.logo {
filter: drop-shadow(0 6px 12px
rgba(79,70,229,.7));
}
Scroll & snap
Native, smooth scrolling UX — swipeable carousels and horizontal rails without a single line of JavaScript.
scroll-snap-type / margin
UXscroll-snap-type on a container plus scroll-snap-align on children makes scroll stops land exactly on each card — a swipeable carousel in pure CSS.
.cards {
display: flex;
gap: 12px;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.cards > * {
flex: 0 0 60%;
scroll-snap-align: center;
}