Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
170 views
in Technique[技术] by (71.8m points)

reactjs - CSS conflicts in react

How to use normal CSS without using any modules or external dependencies like CSS module or styled-components in React avoiding class name collision or CSS overriding to other components?

question from:https://stackoverflow.com/questions/65879570/css-conflicts-in-react

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are at least two ways:

  • to scope it under a class name, for a certain component:

    .employee-data .warning { ... }

  • to scope it under a certain page

    #about-us-page .photo { ... }


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...