覆盖Semantic React Ui属性的CSS。

问题描述 投票:0回答:1

我想覆盖属于 react semantic UI 的默认 Header。

目前,我将我的Header定位在div内,以便为其设置样式。

    <div className="portfolioTitle">
      <Header as="h1">Check the magic</Header>
    </div>

我使用的是div.CSS。

   .portfolioTitle {
      padding-left: 10%;
      position: relative;
      padding-bottom: 3%;
      padding-top: 3%;
    }

但我想在不使用div的情况下实现同样的效果。我试着用以下方法来实现 此法但它不为我工作。

有什么办法吗?谢谢,我想覆盖属于response semantic UI的默认Header。

css reactjs semantic-ui semantic-ui-react
1个回答
1
投票

你可以简单地给 类名道具Header

请看这里的工作演示

此外,你还需要申请 !important 的样式。

: 如果你检查元素,你会发现下面的样式被应用于 Header 由semantic ui库提供。因此,如果您想提供自定义的className,那么使用下面提到的css属性,您就必须使用下面的属性。!important.

.ui.header {
    border: none;
    margin: calc(2rem - .14285714em) 0 1rem;
    padding: 0 0;
    font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;
    font-weight: 700;
    line-height: 1.28571429em;
    text-transform: none;
    color: rgba(0,0,0,.87);
}
© www.soinside.com 2019 - 2024. All rights reserved.