0

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 %?

tony19
  • 125,647
  • 18
  • 229
  • 307
  • Use rem: https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984 http://stackoverflow.com/questions/11799236/should-i-use-px-or-rem-value-units-in-my-css – iamrobert Mar 14 '17 at 14:30

1 Answers1

1

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.

zik
  • 3,035
  • 10
  • 41
  • 62