3 ms·
What if there was a way server-side to look at the CSS and HTML and strip out the elements that won't ever be visible on a specific client device? A bit of HTML
by pixelcort 13y ago
What if there was a way server-side to look at the CSS and HTML and strip out the elements that won't ever be visible on a specific client device? A bit of HTML and CSS parsing, as well as knowledge about the client, and voila: less HTML (and CSS?) to the device!
This way as a developer you still have one HTML page, but smaller devices don't ever get non-visible DOM elements.
- cheapsteak 13y agoYou can do it client side with matchMedia. Instead of setting `display: none` with CSS media queries, make a function to rip out elements with a class like `onlyBig` from the DOM, or better yet, use client side templates and only inject the DOM elements appropriate for that screen to start with.