如何更改materialize.min.css的默认样式?

时间:2019-06-06 08:58:28

标签: reactjs materialize

我想更改react实现对象组件的样式。它使用默认的react-materialize样式表。我正在尝试添加“样式”标签,但是它什么也没做。有没有办法改变默认的实体化样式?这是代码:

      <Collapsible accordion={false} >
      <CollapsibleItem  header="Better safe than sorry. That's my motto." icon="filter_drama">
      CONTENT
      </CollapsibleItem>
      </Collapsible>

      <Collapsible accordion={false} >
      <CollapsibleItem header="Better safe than sorry. That's my motto." icon="filter_drama">
      CONTENT
      </CollapsibleItem>
      </Collapsible>

在此处说明其外观以及所需的结果: https://imgur.com/a/picWtGF (很抱歉,链接不足,无法发布图片)

试图在各处添加样式标签,但未显示任何更改

      <Collapsible accordion={false} style={{padding:0}}>
      <CollapsibleItem style={{padding:0}}  header="Better safe than sorry. That's my motto." icon="filter_drama">
      CONTENT
      </CollapsibleItem>
      </Collapsible>

      <Collapsible accordion={false} style={{padding:0}} >
      <CollapsibleItem style={{padding:0}} header="Better safe than sorry. That's my motto." icon="filter_drama">
      CONTENT
      </CollapsibleItem>
      </Collapsible>

1 个答案:

答案 0 :(得分:0)

<Collapsible accordion={false} style={{padding: "0px !important"}}>

或在您的.css文件中,只需添加类的确切名称。对于您的情况:

.collapsible-body {
   padding: 0px !important;
}