![](/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.