something missing
… along with simplicity.
Everybody involved in coding up web design, knows the following wording…
Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors,
spacing) to Web documents.
… and quite a few reactions related to the word “simple” in this context, have popped up over the years. Some have even
suggested that CSS has (already) become too complex, which apparently is not what it was supposed to be.
It can indeed be hard to remember all the properties/values that have been added to CSS over the years, but that's what we got the W3C's resource-listings for. The mechanism itself is simple enough, in my opinion.
missing custom “switches”
What I miss the most as of today, is more customizable “switch” functionality in CSS. I would like to be able to conditionally turn on/off lines, or whole blocks, of styles based on browser actions and other variables, without having to resort to javascript or HTML element trickery. I find that especially interesting now that latest CSS upgrades (filter, transformation, etc) allow for so much emulation of other functionalities traditionally only available via scripts.
In essence: I'd like to be able to turn any HTML-element, or part of one, into a conditional and/or clickable on-screen
switch in the stylesheet, without having to add or alter anything in the HTML source-code. A 'selector-chain', or
a class
in rare cases, should do to select the desired switch-element.
Would also be nice to be able to turn on/off blocks of styles, make them active or inactive without having to reload stylesheets and/or replace them.
details #1: any element can become a CSS on/off switch
For now we only have :hover
and :active
for such CSS-only effects, and although these are useful in many cases
they do not emulate the “selected/unselected”-functionality of <input type="checkbox">
or <input type="radio">
in full.
Those input
are examples of the kind of “switches” I would like to have in my CSS-only toolbox –
without having to code in actual input
elements. And as these style-switches are not intended to interact with anything outside
the HTML/CSS on page/site levels, one should be able to assign this “manual switch” functionality to more or less
any HTML element that appears logical from a design point-of-view.
If one imagine how a good old stylesheet-switcher written in javascript works, then one type of uses for a CSS-only switch should be quite obvious. Whether or not cookie setting and reading (setting active across a site) should be possible in that particular context, is a “would be nice to have but not really important” addition from my point of view.
details #2: on/off screen as CSS switch
Switching CSS styles based on whether certain elements are in screen-view or not, would be another useful CSS-only functionality. That the element(s) that act as on-/off-screen switches, and the element(s) that styles are switched on, should be allowed to be totally independent of each other, is of course imperative.
Some animation and transformation styling seems to draw considerable amounts of CPU resources also when they act on off-screen parts of a page. Would make sense to be able to automatically switch them on/off as whole style-blocks, depending on where the elements these styles act on are relative to the viewport.
details #3: timed CSS switches
By “timed” I mean that style-switching caused by any of the previously mentioned CSS switch
functionalities. For instance be delayed by a given time-factor, or return to previous state after a given time.
By “timed” I also mean automatically delayed style-switching after completed page-loading. What may
be interesting “decoration” for a few seconds, may end up as irritating distractions after a minute or two and may as
well be switced out and/or reduced.
Some such CSS timing can be achieved today, by timing each event directly. It would however be nice to be able to switch in/out entire blocks of any kinds of styles, or even entire stylesheets, based on time, instead of having to time them individually.
will I ever get what I want?
Priorities regarding CSS development is not for me to decide, so don't know when, if ever, we will get any requested CSS functionality in browsers and written down in web-standards.
The ordinary responses, like “this is unnecessary”, “have no use for it”, “it is not possible”, etc, don't bother me or will have any impact on what I'll put on my wishlists. One or more of those responses have been presented every time something apparently new has been suggested in any and all fields.
In the mean time I'll clutter up my own coding whichever way I want, to get the outcome I'm after. Whatever works – standard-compliant or not.
sincerely
Hageland 17.jun.2020
last rev: 19.jun.2020