Murad Petrosyan
Murad Petrosyan

Reputation: 13

Why css works on every component in React

enter image description here

Basically, I have a react app which is consist of little compoennts like menu home random(its a program), and every child has its own css. but when I write css for home it works in every child. for example when I wrtie div 50px every div in my app becomes 55px. Is there any way to stop this behavior?

Upvotes: 0

Views: 101

Answers (1)

Robin
Robin

Reputation: 262

I gather this is your first time using css :)

Using an html selector (like div or h1) will target every element of that type. Targeting a class will target every element containing that class, and targeting an id will target the one element of that id.

Read more about selectors here: https://www.w3schools.com/cssref/css_selectors.asp

Upvotes: 1

Related Questions