There are two kinds of developers: ones who think this is a reasonable idea, and ones who have written UIs in languages that allow this kind of coupling and learned from their mistakes.
It was just a very lazy approach to handle something they lost control for.
EDIT: I can't seem to reply down below, but in my plugin for example we've implemented a few responsive conditions:
- min-scroll-x
- max-scroll-x
- min-scroll-y
- max-scroll-y
So if you needed to trigger a style (or a whole block of styles) when the page, or any element you specify has a scroll position meets the conditions above.
By combining these conditions with other conditions, it makes it DEAD simple for CSS-only designers to be able to write responsive JavaScript!
@element 'body' and (min-width:900px) and (min-scroll-y: 100vh) { header { position: fixed; } }
Its a worstcase probably, but i also do not find any sitations where it would make more sense to traditional methods.
I'm joking. I actually think the idea of incorporating a simple subset of JS functionality into CSS could be super powerful. There are lots of times when you want a little JS to help with styling, or maybe even basic data fetching and binding. It would be a lot simpler to just keep it in your CSS files. I'd love to hear more about what you're working on.
I've been using this for the past year and its been a life saver!
Dont picture it being gross, picture it like this: http://codepen.io/tomhodgins/pen/RrEpjo
This CSS gives you a sticky header, a page with a min-height of 100% - whatever the footer happens to be, and then if the page expands it just pushes the footer out of the way.
Normally you would either need to know the exact height of the footer in CSS, or you would need to write a little bit of JavaScript to measure the height of the footer.
But keep in mind that if youve got a lot lf content in your footer, its probably going to get very tall at phone width, medium height for tablet users, and be the shortest for desktop users.
So now, how can we write CSS that is able to use this changing value of the footer height on the page? The simplest way is to allow CSS to access the measurement of that element as it has rendered on the page.
If this plugin can help others too, that makes it all the more worthwhile!
I've been doing some experiments with closing the gap between JS and CSS from the opposite perspective of Descartes: writing JS from within CSS using a CSS-like syntax..
My take is that Descartes is the inversion of my plugin - Descartes lets you easily write CSS from JS and JS-style syntax.
Either way - being able write your responsive styles all in one place (whether entirely in JS, or entirely in CSS) is a lot better than cobbling together responsive support using a bunch of custom CSS + JS carefully duct-taped together.
I believe this plugin will help build modular (atomic design) elements that can be re-used on different templates/sites without much re-tooling once they're built the first time.