-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-content] Should content property work with non-string variables? #703
Comments
To be more specific about the skepticism: every use-case I've seen presented for this has been "writing CSS tutorials" (or equivalent). This makes sense, as there's virtually no reason for "5px" or "#aabbcc" to show up on a production website. The only case that's remotely plausible for production is formatting a chart with a %, and displaying that % in text as well. No other value type has any business being printed to the page, really. |
I've mentioned elsewhere that I'd like a string concatenation function for using CSS variables in SVG path data. Part of that would have to be converting numerical variables to string data. A I think this would therefore be a good way to address the use cases for the |
FYI 2: If the value of the CSS variable is a plain integer, you can currently hack the conversion to string with CSS counters. Sorry, I couldn't find the original demo I saw of it, but here's my version on CodePen. Again, it's about being able to visually represent a value and also display it as text. |
The discussion in #542 contains another way to address the issue: a string concat function that can also coerce other values to strings. |
On Twitter there was a request for CSS variables to be used with the content property:
This works only if the variable is a string.
Are there good use cases for this? There was some skepticism on the Twitter thread.
The text was updated successfully, but these errors were encountered: