- Forums
- react
- React Css - How To Add Css Style Within The Same Component In React
this tutorial shows what code to use to add css styling to inside a react component. [5221], Last Updated: Mon Jun 24, 2024
reacter
Wed Oct 11, 2023
0 Comments
201 Visits
To add css styling within the same component and not having to use a external import file, here is one example:
1. declare the css class name:
const LoginSignUpForm = {
height: '100vh',
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
};
2. Apply the class name using the style property
<div className="animated fadeInDown" style={LoginSignUpForm}>
That is it, very easy to do.