Sass ID selector isn't working in React and create-react-library

后端 未结 2 636
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 08:39

I have a library I\'m making with a Header component and a Button component. I gave them ID\'s to identify them in my SASS file, this is my current

2条回答
  •  清酒与你
    2021-01-16 09:08

    I came across the same problem. I am using scss files with module pattern.

    The simplest solution I could find is using attribute selector.

    This does not work:

    #myID {
       color: red;
    }
    

    Instead of above code I used below in my module.scss file and worked:

    h1[id="myID"] {
       color: red;
    }
    

提交回复
热议问题