改变<a>react-bootstrap NavItem 中的元素类 [英] Change the <a> element class in react-bootstrap NavItem
本文介绍了改变<a>react-bootstrap NavItem 中的元素类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 react-bootstrap
并更改 NavItem
内部 元素的类.我尝试使用
className
但它没有影响它.
I am trying to work with react-bootstrap
and change the NavItem
inner <a>
element's class. I tried using className
but it didn't affect it.
我想改变 hover
动作的颜色.我该怎么做?
I want to change the colour of the hover
action. How can I do it?
<Navbar.Collapse>
<Nav pullRight>
<NavItem eventKey={1} href="#">1</NavItem>
<NavItem eventKey={2} href="#">2</NavItem>
<NavItem eventKey={3} href="#" className="my-class">3</NavItem>
</Nav>
</Navbar.Collapse>
CSS:
.xnavbar-tab a {
color: #F89800;
}
推荐答案
要更改使用 bootstrap-react 创建的锚元素(例如在 bootstrap-react 选项卡中),您只需要将一个类分配给父级并让它知道它的锚子节点应该像这样应用它们
to change the anchor element that is created with bootstrap-react (for example in bootstrap-react tabs) you just need to assign a class to the parent and let it know that its anchor children should have them applied like so
.your-class > a
这篇关于改变<a>react-bootstrap NavItem 中的元素类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文