Cyrus Dobbs
Cyrus Dobbs

Reputation: 48

All margins and borders convert from px to %

I am building an online shop for a project.

I have made all the element sizes % to keep the website fluid. However, all my margins and borders are in px, so when the browser is resized or people view on a different resolution screen, it really doesn't work.

I assume it's best that I convert to %, but it is a bit of a tedious task to do manually without a converter or the means for me to convert myself.

How to people get around this? And do I actually want to convert to %?

Upvotes: 0

Views: 55

Answers (1)

zik
zik

Reputation: 3085

I would consider using rem. It's much better and scales nicely. Depending on your browser support which you can check here I would argue it's the best alternative.

I'm not sure if you use Sass but it's another thing that I would consider using as you can create a sass mixin to convert px to rem with a nice fallback to px for older browsers. Here's a link.

It's down to personal preference but these are what I would choose.

Upvotes: 1

Related Questions