#What is the right way for responsive pages?
10 messages · Page 1 of 1 (latest)
Prefer @media in CSS wherever possible is what I would say. Use JS-based BreakpointObserver only as a last resort.
okay, i will try to refactor. Where can i post snippet of code?
Just inline (use code formatting) for short code, otherwise stackblitz or a Git repo
Okay
The advantage of using only css is that you don't have to alter the DOM (expensive) based on device size changes. It is also compatible with server side rendering (BreakpoingObserver only in a limited way, because the server has no idea about the device size)
Sure, thanks. Honestly, I will try to exchange everything tomorrow. It's late right now, so I have to sleep soon. I didn't think I would get an answer right away, so I asked the question now, with the hope that I would have an answer by morning. Thank you
There are also ways to make things responsive without explicit media queries. Such as flex-wrap, auto-columns with Grid or fluid font sizes (https://www.fluid-type-scale.com)