muicss / mui

Lightweight CSS framework
https://www.muicss.com
Other
4.51k stars 426 forks source link

will rem be a better solution than px? #157

Open taojoe opened 8 years ago

taojoe commented 8 years ago

More and more html5 web page use rem, it's mobile friendly. will mui use rem to replace px?

amorey commented 8 years ago

Thanks for creating this issue. Switching to rem has actually been on my mind lately since reading about developers using MUI for plugins like Wordpress (https://github.com/muicss/mui/issues/154).

I think it would be great to move to rem as soon as possible. Is this a project you could work on? I think a big part of the issues can be solved in the variables file: https://github.com/muicss/mui/blob/master/src/sass/mui/_variables.scss

taojoe commented 8 years ago

I'm new at mui. Now i just started the first project with mui, so I need more time to play with it.

Sorry I cannot make sure I can do it recently. I'll focus on this.

cekvenich commented 8 years ago

I think using rem is mistake. All ad units are px. All PWA is px.

You won't have vertical rhythm.

amorey commented 8 years ago

rem is relative to the browser's base font-size measured in pixels so it shouldn't cause problems with ad units. Can you describe a scenario where rem causes problems?

cekvenich commented 8 years ago

So first of all all the advanced and best practices are px. http://developers.google.com/web - they have like 6 sites, all px as best practice. also ALL the award winning web sites (ex awwwards) are .px - they mostly use GSAP and that is all px.

You asked for a reason: one is vertical rhythm of of your site: W/ px your ad is 300x250, you can set your line height to 25 and 50 and font size computed to % of line height(ex: h6 is 64% of line height). So when you need to align... you are already done. Display banner ads and all. Code shows me that MUI lets you set line height and font size. Good luck trying to align (or UI effect) w/ REM. Try tweenTo rem - browser struggles, pave a welcome to jank. There are reasons all day long, no need to play.

Just surf some of the awwards sites - they are truly stunning (and px)

No rem by pros, there are plenty of noob css frameworks, I hope MUI is: 'your 2nd framework' After you paint yourself in a corner w/ the first one.

And here are your sizes: http://support.google.com/adsense/answer/6002621 Now let me ask a question: would you set your image sizes in rem? ;-)

amorey commented 8 years ago

Thanks for those references. I think the key advantage of using rem over em is that it gives the folks using the pre-packaged CSS file a way to scale up/down the MUI font-sizes and widget paddings based on the body font-size. It sounds like there's more to consider so I propose we keep this issue open and get more feedback from other folks before we move forward.

amorey commented 6 years ago

Hi Everyone - the latest version of MUI (v0.9.38) has migrated from 'px' to 'rem' for all font-sizes and some other dimensions which should make scaling up/down more predictable. We also added a $mui-use-rem option to SASS to make px/rem optional. To make it easier for developers to switch back to 'px' we also added a pre-compiled px-only CSS file to the extras directory: https://www.muicss.com/docs/v1/getting-started/extras

Please let me know if you run into any issues using the new version of MUI.