Menu

1 / 2

Can CSS remember a value? A two-cell experiment

DEV Community: css·UULab·9 days ago
#vFEPfcC7
#devtocss#devto#dev#s00z#s01z
Long article (1019 words) — no AI summary yet.
Reading 0:00
15s threshold

Write 3 to address 00 and switch to 01. The display reads 0. Go back to 00 and 3 is still there. This can happen without JavaScript or a storage API because the browser keeps the form’s radio selections while the document is alive. Selecting an address and writing to its cell are separate actions.

01. Address selection leaves the stored value alone

The demo has one radio group for the selected address and one for each of the two cells. CSS displays the selected state in the addressed group. Moving from 00 to 01 does not change which radio is selected in the 00 group. Mutual exclusion applies within a group, so the cells need distinct group names.

Action Address Read value Write bit

Reset 00 0 0

Write 3 00 3 1

Select 01 01 0 0

Select 00 00 3 1

Write 3 again 00 3 0

Reset 00 0 0

We clicked through all six rows in cloud Chrome, at a 1363 CSS px viewport and in a 360 CSS px frame. The second write kept the value at 3 and flipped the write bit from 1 to 0.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.