TLDR Web Dev · ARTICLES & TUTORIALS

HARDEST PROBLEM IN COMPUTER SCIENCE: CENTERING THINGS

tonsky.me8 min read

Summary from the TLDR Web Dev newsletter

Centering UI elements is surprisingly hard due to factors like font metrics (which can be inconsistent), line height complexities, and the difficulty of aligning text with icons. This article shows multiple examples of non-centered text on websites from companies like Apple, Slack, Microsoft, GitHub, and Google. Some tips to align elements properly: stop using fonts for icons, understand your font metrics, and pay more attention to alignment in the first place.