3 ms·
Is there anything which allows user choice (i.e. state) that doesn't involve JS?
by fastball 7y ago
Is there anything which allows user choice (i.e. state) that doesn't involve JS?
- dgb23 7y agoYou can use checkbox inputs (the reason why HTML&CSS is turing complete)
- agret 7y agoYes, although doing things without JS is old school web. I think you'd be hard pressed to find any clients that don't support JS in this era. Anyway, to accomplish this you would split your styles into seperate CSS files and then have a drop-down that does an HTTP POST/GET to a server side script that will then set a cookie on your browser with your preferred choice. Each time a request comes in from the client you just check that cookie for which style they want and then change the HTML that's sent to include a different stylesheet.
- nine_k 7y agoThere's a number of end users who would like to avoid JS on non-app sites.
- Zenbit_UX 7y agoYes, you can use an html checkbox and monitor its state with pure css.
- RobertKerans 7y agoCheckbox + CSS custom properties for the colours/font weights etc . Checkbox checked, adjust the variable values. There's normally a little more to it than that, but there shouldn't ever be _much_ more, custom properties are fully dynamic
- toastal 7y agoThere's also alternative style sheets (https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative...), that can support the media queries on the tags, but I think Firefox is the only browser still exposing the ability to switch the styles, and it sadly don't persist between sessions or even a page navigation/refresh.