When writing CSS in our global file, we often define variables and styles like this:
:root{
--orange:#e67e22;
--black:#333;
--light-color:#777;
--border:.1rem solid rgba(0,0,0,.2);
--box-shadow:0 .5rem 1rem rgba(0,0,0,.1);
}
*{
margin:0; padding:0;
box-sizing: border-box;
outline: none; border:none;
text-decoration: none;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-weight: lighter;
}
html{
font-size: 62.5%;
overflow-x: hidden;
scroll-behavior: smooth;
scroll-padding-top: 6rem;
}
section{
padding:2rem 7%;
}
However, when it comes to writing CSS in our component module.css, things are a bit trickier. For instance, using .section instead of section can cause style discrepancies. Is there a way to apply global styles to our components without running into these issues?
In addition, manually applying custom styles to components can be tedious and time-consuming, especially when utilizing {style.ClassName}
. Is there a simpler or quicker method for styling components with custom CSS?