I am building a responsive page layout and it works great so far, but I have a question:
Should I be using em, px or %?
For example, I want to have border radius applied to an element. Should I use this code:
border-radius: 1.563em;
Or this:
border-radius: 25px;
Should I be using ems for similar properties or should I stick with px?
Generally, don’t use
pxfor responsive layouts.If you use a
px-based media query, then your layout may end up looking like crap when the user zooms. And unfortunately, that I know all to well because I made that mistake too.Regarding your example with
border-radius, you may discover the two look really different when thefont-sizeis increased – demo. The first and the third usepxfor border-radius, while the second and the fourth useem.But there will be exceptions and if something doesn’t feel right on zoom (for example, a
box-shadowthat looks exaggerated), try it withpxas well.Also check this article.