Pure Digital CSS, Swiss Made, Clock – No JavaScript, almost no HTML
quaxio.com
quaxio.com
Of course it might drift over time, but you could also serve up a refresh header to deal with that every hour or so.
I think it's a generational Easter egg that he went with "microwaves" instead of "VCRs" or even "clock radios."
The best part about these projects in not seeing the demo but rather learning the clever hacks that make the things tick (no pun).
Reminds me of a video on Vue mastery in which Evan you created a mini vuejs in like 10 mins. Its one thing to use or see something, something totally another to see how it does what it does behind the scenes.
[0]: https://www.vuemastery.com/courses/vue3-deep-dive-with-evan-...
In a similar vein (but much less techinically sophistcated), I recently realized that making "cloze" cards (esp. ones w/ a large number of deletions and/or incremental-reveal cards) in Anki can be made a much less painful process by ditching the native method in favor of an almost entirely CSS implementation (basically, you use Anki's editor to underline the cloze deletions, use a line of JS to add innerText as an attribute to the element, and use CSS to make each answer appear in a little pop-up as you hover over (or touch, if on mobile) a blank. An example: https://streamable.com/xwewa4).
Note that in chromium there's an implicit style tag that doesn't show up in chrome.
Manually adding
style {
display: none;
}
fixes the issue with no ill effects in Chrome.So it is 2 x 0 = 0 versus 86,400 x 0 = 0
Looks the same to me!
CSS hasn't changed much since its inception in 1996, mostly it's added some selector and layout rules in recent years.
And its not because of the challenge, its because of the result. Which makes me more surprised that other people's activity puts this stuff on my feeds at all.
I love those css felx's though this is cool
Except for the HTML
While technically correct is the best kind of correct, it's worth noting that the entirety of the HTML portion is:
<link rel="stylesheet" href="pure_css_digital_clock.css"> <html><head><link rel="stylesheet"
href="pure_css_digital_clock.css">
</head><body></body></html>
The inspector works fine, but the inspector also does not present the HTML as it was sent, but rather the DOM that Firefox is rendering.None of this is important, it's just fun to poke at these CSS demos a little and see how the browser acts.
Looks like they moved it into the Tools -> Web Developers menu. Ctrl+U still works too!
<html>
<head>
<link rel="stylesheet" href="pure_css_digital_clock.css">
</head>
<body></body>
</html>
Indeed the the CSS defines styles for the <body> element. So this whole thing would not be possible there was no HTML (or some structured document representation). See, the part about lack of HTML in the title is completely unnecessary.view-source:https://www.quaxio.com/pure_css_digital_clock.css
No, there was (and still is) no asterisk in the title of this post.
I can see this POV, but this isn't really how I've thought of a "timer" myself.
I've always thought a timer was just a thing which kept track of time elapsed (up or down). For example when I'm doing metrics I've always used "timers" to measure how quickly a program runs. I would never call a function which measures how long a process runs a stopwatch function, it would be a timer (or timing) function.
Until I owned an iPhone I've always thought of a stopwatch as the literal physical thing.
For what it's worth I would define both a timer and a clock as something that ticks(/updates) at a fixed regular interval.
A page which says 12:00:00 every time I go there isn't a clock in my book.
Q: Swiss made, how so? A: I was born in Switzerland. By induction, this clock is Swiss made. QED.
I know this is a tongue in cheek thing, but I find it pretty repulsive to mark a piece of software "Made in X" when it is clearly an international cooperation - CSS, Browsers, TCP protocol, etc is many countries getting together and building stuff. Let's keep nationalism out of software yall.
Something that I find repulsive is sort of related (usually Swissmade or Xmade is taking pride in their nationality, aka nationalism), it is not completely tangent. Obviously, there was a reaction in my brains when I saw "Swiss made" that made me comment here and express.
*, ::before, ::after {
animation-delay: var(--delay);
}
… and this JS: var d = new Date();
document.documentElement.style.setProperty("--delay",
-(d.getHours() * 3600 +
d.getMinutes() * 60 +
d.getSeconds() +
d.getMilliseconds() / 1000
) + "s");
I think this would do it. It roughly matches what I did a few years back for an analogue CSS-only (except for this) clock.However, this does still have a weakness: if the browser is suspended (e.g. machine in standby) it gets out of sync. It doesn’t care about leap seconds, either. You could fix these things by triggering this position update every so often, but that would be missing the point of it.
Remember also that the clock will be out of sync if you set it server-side, because of latency between the server and client. This inaccuracy would doubtless besmirch the name of Swiss timepieces. Could be fun hooking into TCP and TLS negotiation to estimate latency in order to compensate in the animation-delay and make it probabilistically more accurate. Now that would be a fun article to read. I’m almost tempted to devise a way to do this myself. I suspect I couldn’t get the necessary information through my standard nginx reverse proxying arrangement and would need to serve the CSS from a different port so that I could handle the negotiation in a process of my own and observe the timings.