Skip to content

Instantly share code, notes, and snippets.

@niikkiin
Created July 20, 2020 15:59
Show Gist options
  • Save niikkiin/44be6d8e8f1525df5c55515dcecf0e09 to your computer and use it in GitHub Desktop.
Save niikkiin/44be6d8e8f1525df5c55515dcecf0e09 to your computer and use it in GitHub Desktop.
For creating global styles with reset using styled-components
import React from 'react';
// import the global styles
import { GlobalStyles } from 'utilities/styles/global.styles';
function App() {
return (
<>
<GlobalStyles />
Hello carrots
</>
);
}
export default App;
import { createGlobalStyle } from 'styled-components';
export const GlobalStyles = createGlobalStyle`
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 62.5%; /* equivalent to 10px; 1rem = 10px; 10px/16px */
}
body {
box-sizing: border-box;
font-family: 'Muli', sans-serif;
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment