terribleMia’s avatarterribleMia’s Twitter Archive—№ 6,564

  1. html <body style="--{{ current.slug }}: var(--active-nav);"> {% for page in nav %} <a style="--is-active: var(--{{ page.slug }});"> 👆 If the slugs match, var(--is-active) == var(--active-nav) for that link
    1. …in reply to @TerribleMia
      css body { --active-nav: 1; } a[style*="--is-active:"] { text-decoration-color: hsla(0, 0%, 0%, var(--is-active, 0)); } 👆 Use var(--active-nav) as a toggle (in this case 1 or fallback to 0), and apply it to a toggled "active" style
      1. …in reply to @TerribleMia
        If you can set an .is-active class directly, I mean, that's simpler... But this works!