4 ms·
For #5 use rem which is based off the document font-size rather than the current elements font size. </pedantic> What really needs to stop is the use of pixels
by extrapickles 8y ago
For #5 use rem which is based off the document font-size rather than the current elements font size. </pedantic> What really needs to stop is the use of pixels and absolute font sizes for sizing everything as they never work on more than 1 device/zoom level/default font size.
Breaking layout into its own thing has its ups and downs. Basically you would have to break out what flexbox and grid do into a "layout" file, and come up with syntax that makes describing relationships easier than they currently are in CSS/LESS/etc. The downside to this would be that you have to chase UI bugs through 3 files rather than the current 2.
What CSS could use is a good clean as its grown organically for quite some time.
- ZenPsycho 8y agoThat's all well and good but rems only became broadly usable relatively recently, and I've had to make web pages a lot longer than that. And also fix webpages written well before that.
- RandyRanderson 8y agorems don't work either because there are instances where you need to have things line up exactly. For example, if you have 3 columns. You will be one pixel out. There are no good ways to fix this. See [0] https://johnresig.com/blog/sub-pixel-problems-in-css/ https://johnresig.com/blog/sub-pixel-problems-in-css/ CSS should only be used to appease those ppl in your org that read/write more blog posts than code. Use JS if in doubt. You're welcome.
- dan-robertson 8y agoI tried and failed to recreate that example (from 2008). Modern browsers do seem to do a reasonable amount of sub pixel rendering. Maybe rems are bad but that article does not demonstrate it.
- RandyRanderson 8y agoDid you try it on ie11? That was the only one we experienced it on. Of course we had to support ie, which meant a layout re-write. :<