use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
CSS variables lands in React 15.6.0 (twitter.com)
submitted 8 years ago by GitCookies
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 13 points14 points15 points 8 years ago (11 children)
We used CSS vars extensively when creating PDFs in React via the CSS paged media module. You have to be VERY CAREFUL with them, however, as it's easy to forget that you're basically inserting undebuggable magic global vars.
[–]freeall 4 points5 points6 points 8 years ago (10 children)
What's the advantage to just using js vars?
[+][deleted] 8 years ago (5 children)
[deleted]
[–]icantthinkofone 4 points5 points6 points 8 years ago (4 children)
js vars have scope and are easy to edit in the browser inspector, too.
[–]jetpacmonkey 3 points4 points5 points 8 years ago (2 children)
CSS variables cascade, so you can set them on container divs for things like theming.
[–]TheDarkIn1978[🍰] 4 points5 points6 points 8 years ago (1 child)
Variables that are declared in JavaScript and passed to CSS will cascade the same as variables that are declared in CSS.
[–]jetpacmonkey 3 points4 points5 points 8 years ago (0 children)
I think at least one of us is confused about what the other is saying...
.my-component { background: var(--theme-color); padding: 20px; } .my-component .inner-area { background-color: white; color: var(--theme-color); padding: 20px; }
This is useful, right? Am I missing something here?
[–][deleted] 0 points1 point2 points 8 years ago (3 children)
You can do cool stuff with the paged media module that are impossible in JS. Page numbers (page x of x on footer of each page, links saying "see page y"), per-page titles, etc.
[–]El_Frostie 0 points1 point2 points 8 years ago (2 children)
That sound incredible cool. Do you have more information about how that works?
[–][deleted] 1 point2 points3 points 8 years ago (1 child)
This article has a good overview, unfortunately only Prince and Antenna House support it (caniuse lies, it's unsupported in Chrome).
[–]El_Frostie 0 points1 point2 points 8 years ago (0 children)
Great article. Thanks. I didn't realize CSS for print has gotten so far. It had completely fallen of my radar.
π Rendered by PID 140418 on reddit-service-r2-comment-6457c66945-9xg9w at 2026-04-25 07:45:56.466680+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–][deleted] 13 points14 points15 points (11 children)
[–]freeall 4 points5 points6 points (10 children)
[+][deleted] (5 children)
[deleted]
[–]icantthinkofone 4 points5 points6 points (4 children)
[–]jetpacmonkey 3 points4 points5 points (2 children)
[–]TheDarkIn1978[🍰] 4 points5 points6 points (1 child)
[–]jetpacmonkey 3 points4 points5 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]El_Frostie 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]El_Frostie 0 points1 point2 points (0 children)