CSS custom properties in generated content

:root {
--my-value: 1em;
}
.my-element {
margin-bottom: var(--my-value);
}
@media all and (min-width: var(--my-value)) {
...
}
:root {
--number-value: 15;
}
.my-element::before {
content: var(--number-value);
}
.my-element {
counter-reset: mycounter 15;
}
.my-element {
content: counter(mycounter);
}
:root {
--number-value: 15;
}
.my-element {
counter-reset: mycounter var(--number-value);
content: counter(mycounter);
}

--

--

A web developer and author living and working in Brighton, England. Everything I post on Medium is a copy — the originals are on my own website, adactio.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jeremy Keith

Jeremy Keith

A web developer and author living and working in Brighton, England. Everything I post on Medium is a copy — the originals are on my own website, adactio.com