Tag

#css

37articles
GuidesNov 2, 2026

How to detect a touch screen in JavaScript and CSS — and why ontouchstart lies

How to detect a touch device on a website: step by step with CSS @media (hover) and (pointer), matchMedia and pointerType — and why ontouchstart gets it wrong.

6 min read
GuidesOct 31, 2026

Why your CSS transition isn't working — 4 reasons the element jumps instead of animating

Why a CSS transition doesn't work: display none, height auto, a class added in the same frame, and animations turned off. How to check each cause and fix it.

6 min read
GuidesOct 29, 2026

Why my page jumps when a modal opens — and why you can't see it on a Mac

Does your page shift sideways when a modal opens? Here's the cause — a disappearing scrollbar — and the fix with scrollbar-gutter: stable and padding-right.

5 min read
GuidesOct 29, 2026

How to detect an element's size change — and why window.resize stays silent

How to detect an element's size change in JavaScript: step by step with ResizeObserver, why window resize doesn't fire, and how to fix the ResizeObserver loop error.

6 min read
BasicsOct 29, 2026

border vs outline — the difference, and why a hover border makes everything jump

border vs outline in CSS: the difference, why a border on hover shifts your layout by 2 pixels while outline doesn't, and which to use for focus and cards.

5 min read
GuidesOct 27, 2026

Why my numbers jump when they change — the timer jitters and the text next to it moves

Why a timer or counter jitters and shifts the text beside it: proportional digits, changing digit count, and fonts without tabular-nums. How to fix it.

6 min read
GuidesOct 27, 2026

How to make a carousel (slider) with CSS — no library, native swipe

How to build a pure-CSS carousel with scroll-snap: native swipe on phones, arrows and dots in 20 lines of JS, no slider library and no broken Back gesture.

7 min read
?
BasicsOct 15, 2026

What is the Shadow DOM — and why your CSS can't reach the widget

The Shadow DOM in plain words: why page styles don't apply inside a widget while fonts and colors leak in, and why querySelector can't find a button you can see.

6 min read
01
GuidesOct 15, 2026

How to make font size responsive — and why font-size in vw breaks zoom

How to make responsive font size in CSS with clamp(): a two-point formula, ready-made values, and why font-size in pure vw refuses to grow when users zoom in.

6 min read
GuidesOct 13, 2026

How to capitalize the first letter — without turning iPhone into Iphone

How to capitalize the first letter of a string in JavaScript and CSS: step by step, with empty strings, leading quotes, Turkish i and names like McDonald.

6 min read
GuidesSep 18, 2026

Why the iPhone zooms in when you tap an input field

An input field zooms the page on iPhone because its font size is under 16px. How to check it, how to fix it, and why the maximum-scale advice only hurts.

5 min read
BasicsSep 18, 2026

What is line-height — and why 1.5 and 150% give different results

What line-height is in plain words: how the browser builds a line box, why 1.5 and 150% inherit differently, and what value to use for body text.

5 min read
BasicsSep 18, 2026

What is a variable font — one file instead of eight

What a variable font is: how variation axes replace a dozen files with one, why font-weight 437 exists, and when this actually makes your site faster.

5 min read
BasicsSep 18, 2026

What are CSS variables — and why they live inside the browser

What CSS variables are in plain words: how var() works, why they inherit unlike Sass variables, and the three gotchas that trip up almost everyone.

5 min read
GuidesSep 18, 2026

How to truncate text with an ellipsis in CSS — step by step

How to truncate text with CSS: one property isn't enough, you need three. Single-line, multi-line clamping, and the flexbox trap that breaks both.

5 min read
BasicsSep 18, 2026

em or rem — what's the difference and which to use

em vs rem in CSS: what each unit measures against, where em compounds and breaks, and why both ignore your html font-size inside media queries.

5 min read
GuidesSep 17, 2026

Why my page scrolls sideways on mobile — and how to find the culprit in a minute

Horizontal scrolling on mobile: three real causes and a snippet that names the guilty element instantly. Plus why overflow-x hidden is a bad fix.

6 min read
BasicsSep 17, 2026

What is z-index — and why 9999 doesn't help

What z-index actually is: why a modal with z-index 9999 still slips under the header, what a stacking context is, and how to fix it without bigger numbers.

5 min read
BasicsSep 17, 2026

What is the CSS box model — and why your block is wider than you set

The CSS box model in plain words: why width 350px renders as 370px, what box-sizing border-box changes, and why four 25% columns don't fit on one line.

5 min read
BasicsSep 17, 2026

What is a container query — the media query that doesn't look at the screen

CSS container queries in plain words: why @media fails a component in a narrow sidebar, how @container works, and the two traps tutorials skip.

5 min read
GuidesSep 17, 2026

How to center a div — 4 ways and when to use each

How to center a block horizontally and vertically: margin auto, flex, grid and the new align-content in a plain block. With code and a rule for picking one.

6 min read
BasicsSep 17, 2026

Flexbox or Grid — which to choose (and the sign you chose wrong)

Flexbox vs CSS Grid: the real difference, the criteria to choose on, and the one sign that tells you you picked the wrong layout. With examples and a verdict.

6 min read
GuidesSep 16, 2026

Why 100vh is taller than the screen on mobile — 3 causes and how to fix them

Your 100vh block spills past the phone screen and the button hides under the address bar? Three causes explained: browser bars, the keyboard, the gesture bar.

7 min read
BasicsSep 16, 2026

What is the safe area — and how one word in a meta tag hides your button under the notch

The safe area is the part of the screen no notch, rounded corner or gesture bar covers. How env() handles it in CSS and what viewport-fit turns off.

6 min read
BasicsSep 16, 2026

What is prefers-reduced-motion — and why less motion doesn't mean no animation

prefers-reduced-motion is the Reduce Motion system setting your site reads with one line of CSS. Which motion makes people sick and what you can keep.

6 min read
BasicsSep 16, 2026

What is forced colors mode — when Windows repaints your website

Forced colors is the high contrast mode where Windows swaps your site's colors for its own. What breaks, how to test it in a minute, and the CSS fixes.

6 min read
BasicsSep 16, 2026

object-fit: cover vs contain — which one stops images from squashing or getting cropped

object-fit: cover vs contain compared on cropping, empty bars, card grids and photos of people. Plus scale-down for logos and object-position.

6 min read
GuidesSep 15, 2026

Why your focus outline disappeared — 4 causes and how to bring it back

No focus outline when you press Tab? Four causes: outline: none in your CSS, a clipping parent, a sticky header and color — how to check and fix each.

7 min read
BasicsSep 15, 2026

What is tab order — and why CSS can't rearrange it

Tab order is the queue the Tab key follows through links and fields. Where it comes from, why CSS order breaks it, and which tabindex values are safe.

6 min read
BasicsSep 15, 2026

display: none vs visibility: hidden — the difference, and what screen readers hear

display: none vs visibility: hidden compared on layout space, clicks, Tab, screen readers and animation. Plus a way to hide an element from eyes only.

6 min read
GuidesSep 14, 2026

Why position: sticky isn't working — 3 causes and how to find yours in a minute

Your position: sticky header scrolls away with the page? Three common causes — a missing top, overflow on a parent, no room to move — and how to check each.

6 min read
GuidesSep 2, 2026

How to Add a Loading Skeleton — Six Steps and the One Detail Everyone Forgets

Step by step: how to build a CSS loading skeleton without a layout jump, without flashing on fast responses, and without breaking accessibility.

6 min read
GuidesAug 15, 2026

Why my font doesn't load — 3 causes and how to check each

Font not loading and your site falls back to a system one? Three real causes: the url() path, a silent CORS block, and a missing subset — with fixes.

5 min read
GuidesJul 11, 2026

How to add dark mode to your site — in 3 steps, no libraries

You don't redraw a site for dark mode: CSS variables and one media query do 80% of the work. A step-by-step guide to add dark mode from scratch.

5 min read
GuidesJul 9, 2026

How to add dark mode to your site — in 4 steps (no manual repainting)

How to add dark mode to a website without repainting everything by hand. 4 steps — color variables, a toggle, remembering the choice. AI prompt included.

6 min read
GuidesJul 1, 2026

Why your CSS isn't working — 3 causes to start with (a hard refresh fixes half)

Why your CSS isn't working: you change a style but the page looks the same. The 3 common causes — cache, specificity, linking — and how to fix each.

6 min read
AI toolsJun 28, 2026

Tailwind vs Plain CSS — What Should a Beginner Pick in 2026

Tailwind or plain CSS? We compare on speed, learning curve, and readability — and give a straight answer on who should pick what. Plus why AI almost always writes Tailwind.

6 min read