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 mech­a­nism 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 condi­tionally turn on/​off lines, or whole blocks, of styles based on browser actions and other vari­ables, without having to resort to java­script or HTML element trickery. I find that especi­ally interesting now that latest CSS upgrades (filter, trans­for­ma­tion, etc) allow for so much emula­tion of other func­tion­alities tradi­tion­ally only avail­able via scripts.

In essence: I'd like to be able to turn any HTML-element, or part of one, into a condi­tional and/or click­able on-screen switch in the style­sheet, with­out having to add or alter any­thing 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 style­sheets 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/​un­selected”-func­tion­ality 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” func­tion­ality 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 pos­sible in that parti­cular con­text, is a “would be nice to have but not really important” addi­tion 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 inde­pen­dent 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 auto­mati­cally switch them on/off as whole style-blocks, depending on where the elements these styles act on are relative to the view­port.

details #3: timed CSS switches

By “timed” I mean that style-switching caused by any of the previously mentioned CSS switch func­tion­ali­ties. For instance be delayed by a given time-factor, or return to previous state after a given time.
By “timed” I also mean auto­mati­cally delayed style-switching after comp­le­ted 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 how­ever be nice to be able to switch in/​out entire blocks of any kinds of styles, or even entire style­sheets, based on time, instead of having to time them indi­vidu­ally.

will I ever get what I want?

Priorities regarding CSS develop­ment is not for me to decide, so don't know when, if ever, we will get any requested CSS func­tion­ality in browsers and written down in web-standards.

The ordinary responses, like “this is un­neces­sary”, “have no use for it”, “it is not pos­sible”, etc, don't bother me or will have any impact on what I'll put on my wish­lists. One or more of those responses have been presented every time some­thing appar­ently new has been sug­gested in any and all fields.

In the mean time I'll clutter up my own coding which­ever way I want, to get the out­come I'm after. What­ever works – standard-compliant or not.

sincerely  georg; sign

Hageland 17.jun.2020
last rev: 19.jun.2020

www.gunlaug.comadvice upgradeadvice upgrade navigation