![](/img/trans.png)
[英]how to change the line color in the NavBar toggle button in react-bootstrap?
[英]How to change the color of one of my 5 tabs in react-bootstrap?
<Tabs defaultActiveKey="recent" >
<Tab eventKey="recent" title="Recent">
</Tab>
<Tab eventKey="popular" title="Popular">
</Tab>
<Tab eventKey="all" title="All">
</Tab>
<Tab eventKey="category" title="Category">
</Tab>
<Tab eventKey="myconversation" title="My Conversation" >
</Tab>
</Tabs>
我在其中一個組件中有五個選項卡,我只想更改一個選項卡“我的對話”的字體顏色。 我嘗試將 class 同時添加到父級和子級,但它沒有改變顏色。 請提出任何解決方案。
您需要將tabClassname
添加到<Tab />
組件,如下所示:
<Tab tabClassName="color-red" eventKey="profile" title="Profile">
Tab Profile content
</Tab>
和一點 CSS 樣式:
.color-red {
color: red;
}
.nav-tabs .nav-item.show .nav-link,
.nav-tabs .nav-link.active.color-red {
color: green;
}
試試這個代碼
<Tab eventKey="myconversation" title="My Conversation" style={{ color: "red" }} >
</Tab>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.