Home > Enterprise >  How to set same styles for different tags using styled-components and without CSS files
How to set same styles for different tags using styled-components and without CSS files

Time:08-09

I have a single-page website where I want every section to have the same primary style. The problem is that one section is header, the other footer, and the rest div. I would like to know the best way to use styled-components to achieve this behaviour. In CSS, I would have a selector .section in a global styles file, but as I understand, the styled-components GlobalStyle is only used to set general styling. If I want to use styled-components I will end up repeating the same code for every section. Thanks in advance for any help you can provide.

CodePudding user response:

If you use js and css. then add the style (your css tag) to the _app.css file. Then you can use the style on different pages.

hope i can help

CodePudding user response:

Yes, it is possible to handle the CSS part from the styled-components. So you should use a global style CSS file. For all common CSS

For more reference follow this link

  • Related