3 ms·
2vw would be a reasonable substitution, as it creates a dynamic margin, based on the screen's "view width". Smaller screens → smaller margins.
by charliepark 8y ago
2vw would be a reasonable substitution, as it creates a dynamic margin, based on the screen's "view width". Smaller screens → smaller margins.
- JoshuaRLi 8y agoThanks for bringing vw to my attention, it sounds great! I tried it out and the main problem is 2vw looks much more reasonable on many mobile displays, but puts a lot of top margin on wide screens (laptops/monitors). I still want to retain the same size margins for top/bottom and left/right, so a happier medium would be to vw for mobile and rem for tablets/laptops/monitors, but then that's too much trouble for diminishing returns in my opinion.
- mrb 8y agoJust use 1rem everywhere. There is no reason for the hideously large 2rem margin. Another person said it's just opinion, but I'm sure 9 out of 10 users would tell you 1rem is the better looking option overall.
- ponyous 8y agoThere is `vh` as well, it works the same way, but instead of working relative to viewport width vw, it works relative to viewport height vh.