Writing about design
Eight write-ups on why the values are what they are: what HSL lets you do that HEX does not, where the 4.5:1 contrast ratio comes from, when rem beats px, how an aspect ratio survives a resize. For anyone who has been copying numbers without knowing what they control.
How to Put a Gradient on Text in CSS
A gradient cannot be a text colour, so it is painted behind the letters and clipped to them. Three lines do it; the rest of the work is what happens when the clip fails.
ReadChoosing Colours for Dark Mode
A dark theme is a second palette, not a negative of the first. What to change, and which numbers to check again.
ReadsRGB vs Display P3, and Why Your Colours Shifted
A hex code is a set of numbers, and the numbers only mean a colour once you know which space they are measured in.
ReadWhat Contrast Ratio Do You Need for Readable Text?
Four numbers cover every case, and the one most people get wrong is what counts as "large text".
Readpx vs rem vs em: Which CSS Unit to Use When
They all resolve to the same kind of length. The difference is who controls the number they get multiplied by.
ReadHow to Choose a Colour Palette That Actually Works
A colour wheel hands you five hexes in ten seconds. The other 90% of a palette is neutrals, states and contrast.
ReadHEX, RGB and HSL: Which Colour Format to Use
They describe the same colours. The difference is that one of them you can edit by hand and the other two you cannot.
ReadWhy Your CSS Gradient Goes Grey in the Middle
Blue to yellow passes through dead grey because of arithmetic, not because your browser is broken. Here is the arithmetic, and the two fixes.
ReadHow CSS box-shadow Works (and Why Yours Looks Fake)
Four lengths and a colour, and almost everyone misreads the third one. What blur, spread and inset really do.
ReadHow CSS border-radius Works, Corner by Corner
Every corner is a quarter ellipse with two radii. Once you know that, the shorthand and its odd clamping rule stop being mysterious.
ReadWhat Is Aspect Ratio? 16:9, 4:3 and the Rest
A ratio is one division: width over height. Here is how to read the notation, work out a missing dimension, and see why the answer keeps coming out as a fraction of a pixel.
ReadWhere to start
Two of these change how people work rather than just explaining something. The WCAG contrast ratio turns an aesthetic argument into a number anyone can check, and px against rem against em settles a decision that silently determines whether your site respects someone's browser font size.
After those, hex, RGB and HSL is the foundation the rest of the colour pieces build on, and it is short.
What these pieces have in common
Every value in a stylesheet is a decision someone made about a trade-off, and most of them have a default that quietly wins when nobody decides. A unit chooses between your control and the reader's. A colour space chooses between how a value is stored and how it is perceived. A contrast ratio chooses between the look you wanted and the people who can read it.
The writing here is about what each value actually controls, including the cases where the honest answer is that it does not matter. Border radius and box shadow are mostly syntax. sRGB against Display P3 and choosing colours for dark mode are not, and both of them catch people who assumed a palette would simply carry over.
Frequently asked questions
Should I use px, rem or em in CSS?
Use rem for font sizes and most spacing, because it scales with the reader’s browser setting and someone who enlarged their default text gets what they asked for. Use em when a value should scale relative to the element’s own font size, such as padding inside a button. Use px for things that are genuinely fixed, like a one pixel border.
Why do my colours look duller after I export a screenshot?
Because the original was captured in a wide gamut such as Display P3 and the destination assumed sRGB. The numbers are carried over without the profile that gave them meaning, so saturated colours land inside the smaller space and flatten. Converting deliberately, rather than letting it happen, keeps the intent.
Can I make a dark theme by inverting my light one?
Not successfully. Pure white on pure black causes halation that makes text hard to read, saturated colours appear to glow against a dark background, and every contrast ratio that passed in the light theme has to be measured again. A dark theme is a second palette rather than a transformation of the first.
All categories
PDF 10Images 10Text 14Security 8Calculators 13Developer 20Everyday 4Time 7