Styling components with CSS
In this section, we're going to style the body, app container, and header container with regular CSS and understand the drawbacks of this approach.
Styling the document body
We are going to use the traditional approach to style the document's body. Follow these steps to do so:
- Open
index.tsx. Remember thatindex.tsxis the root of the React component tree. Notice how the CSS file is referenced:import './index.css';
To reference a CSS file in a React component, we specify the location of the file after the
importstatement.index.cssis in the same folder asindex.tsx, so the import path is./. - Open
index.css. Notice that we already have CSS in place for thebodytag. Let's remove everything apart frommarginand add a background color:body { Â Â margin: 0; Â Â background-color: #f7f8fa; } - Let's also remove the redundant
codeCSS class inindex.css.Congratulations, we have just applied some...