Since you're using the ES6 import syntax you may use the same syntax to import your stylesheet
import './App.css'
Also, you can wrap your class with :global to switch to the global scope (this mean CSS Module won't modulify it, eg: adding a random id next to it)
:global(.myclass) {
background-color: red;
}
Answer from felixyadomi on Stack Overflowreactjs - How to apply global styles with CSS modules in a react app? - Stack Overflow
Do you have your own global.css file?
TUTORIAL – Add Global Styles in CSS
[feature request] use subreddit style with global style setting disabled
I was just wondering what to do with the rest of my afternoon, too.
More on reddit.comVideos
Since you're using the ES6 import syntax you may use the same syntax to import your stylesheet
import './App.css'
Also, you can wrap your class with :global to switch to the global scope (this mean CSS Module won't modulify it, eg: adding a random id next to it)
:global(.myclass) {
background-color: red;
}
This can be done by simply adding:
require('./App.css');
(thanks @elmeister who correctly answered this question.)
As someone who's learning about Web Dev (with React), I just noticed how handy a global.css file is for keeping the same look across all of the pages and components.
I'd establish a palette of at least 5 matching colors to use. I'd set responsive font sizes for different devices. I could also set how buttons should look like and behave. And so on...
Question is, is this a common practice? Is that how you or your company keep the styles unified for every single project's frontend?
Example:
.global-title {
font-size: 0.8rem;
font-weight: 600;
}
/* Medium screens */
@media (min-width: 768px) {
.global-title {
font-size: 1rem;
}
}
/* Large screens */
@media (min-width: 1024px) {
.global-title {
font-size: 1.2rem;
}
}