Set the CSS-only clock with the HTML <time> element
· 509
Wajdi Alkayal Wajdi Alkayal

Set the CSS-only clock with the HTML <time> element

<time>

<time id="time" datetime="2021-11-29T03:58">Now</time>
--setTimeHours: 3;
--setTimeMinutes: 58;

Attribute selectors

[datetime*="T03"] ~ .clock {
--setTimeHours: 3;
}
[datetime*=":58"] ~ .clock {
--setTimeMinutes: 58;
}
@for $i from 0 through 9 {
[datetime*="T0#{$i}"] ~ .clock { --setTimeHours: #{$i} }
}
@for $i from 10 through 24 {
[datetime*="T#{$i}"] ~ .clock { --setTimeHours: #{$i} }
}
@for $i from 0 through 9 {
[datetime*=":0#{$i}"] ~ .clock { --setTimeMinutes: #{$i} }
}
@for $i from 10 through 60 {
[datetime*=":#{$i}"] ~ .clock { --setTimeMinutes: #{$i} }
}

Related Posts
Graphic design
09 June
The Power of Email Marketing
03 June
Photography
01 June

WMK Tech Copyright © 2024. All rights reserved