How to inject transition global styles only after other global styles are loaded?
See original GitHub issueSteps to reproduce
I tried to add transitions to body alongside other body styles (e.g CSS reset styles) using createGlobalStyles
:
body {
transition: all 1s ease;
font-size: 14px;
color: grey;
}
(The use case for the transition is I will switch the body color and background using styled-theming, and would like it to elegantly transition between light and dark themes.)
Expected Behavior
I would like the transition animation to only apply after the initial global styles have been applied.
Actual Behavior
The transition applies to the other global body styles added alongside it, causing the page to “jump” on page load as things like font size and color resets have transitions applied on them.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
How to apply global styles with CSS modules in a react app?
The first rule should be to include all global styles, assuming it's kept in /styles/ or similar directory. The second rule is to...
Read more >Component styles - Angular
While Angular's default style encapsulation prevents component styles from affecting other components, global styles affect all components on the page.
Read more >How to Create Global Styles with Styled Components
Step 1: Create a global styles file The first step is to create a file that contains all your global styles. Inside your...
Read more >transition - CSS: Cascading Style Sheets - MDN Web Docs
The transition CSS property is a shorthand property for transition-property, ... Global values */ transition: inherit; transition: initial; ...
Read more >vercel/styled-jsx: Full CSS support for JSX without compromises
Injecting styles upon render; Only injecting a certain component's style once ... To skip scoping entirely, you can make the global-ness of your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Put the style behind a class and add the class to body on mount of your app On Sat, Oct 13, 2018 at 2:49 AM Stephen Koo notifications@github.com wrote:
That only apply after full application mount? Probably not. You’ll need some imperative DOM code somewhere to add a class or other DOM marking to signify the initial render pass is complete.