Design a responsive site with em-based sizing

You've probably heard that you should use relative units for font size. This is a good rule for accessible web design; if the user changes their browser's default font size, this enables your page's text to resize accordingly. You may have taken this advice and made the switch. Perhaps you got out your calculator and converted your site's font sizes from absolute px units to ems or, more likely, rems.

But if that's where you stopped, you are missing out on a lot of the flexibility and power that ems bring to the browser. The em unit is not simply a replacement for the familiar px; you can use it for more properties than just font-size. If you do, some of its other benefits begin to emerge.

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

Keith is a senior web developer at Intercontinental Exchange
Latest in Responsive Design
website mockups
Mobile website design: Why is it important and what is the process?
AR design: iFly380
8 golden rules for AR design
Mobile design: Apes gather in front of a Monolithic black smartphone; it glows with various UI elements. In the background lies a mountain range lit by a rising sun that radiates out in concentric circles.
8 golden rules of mobile design
Progressive web apps
PWAs: Welcome to the mobile revolution
Customise sites with these responsive WordPress themes
6 great tools for testing responsive design for websites
Latest in How to
Rob Redman's snowy image illustrates the AE tutorial: TDW313.PT_AE_Snow.indd
How to create realistic snow with particle systems using After Effects
Ivan Mironenko ZBrush character tutorial
Craft a game-ready character asset using ZBrush and Substance 3D Painter
Oliver Schümann ZBrush bizarre baby tutorial
Create a bizarre baby sculpture in ZBrush
Alireza Khoshpayam arch-viz tips
Speedy tips to create beautifully photoreal archviz using 3ds Max and Corona
Maya 3D abstract strands tutorial
How to easily create complex and abstract animation using Maya
Whiskytree battle damage effects tutorial
Create gnarly battle damage for vehicles using a mix of Maya and Nuke