【发布时间】:2018-11-30 22:02:30
【问题描述】:
在react-bootstrap 中使用我的NavDropdown,我无法设置其颜色或背景颜色的样式...
<NavDropdown eventKey={3} className="text-center" style={{ fontSize: `130%` }} title="Items to Choose" >
<LinkContainer to="/about">
<MenuItem eventKey={3.1} className="text-center">About</MenuItem>
</LinkContainer>
<MenuItem divider />
<LinkContainer to="/products">
<MenuItem eventKey={3.2} className="text-center">Products</MenuItem>
</LinkContainer>
<MenuItem divider />
<LinkContainer to="/blog-index">
<MenuItem eventKey={3.3} className="text-center">Blog</MenuItem>
</LinkContainer>
</NavDropdown>
我可以使用style={{ fontSize: '130%' }} 更改字体大小,但我还想使用...更改颜色和背景颜色,..
style={{ fontSize: '130%', color: '#fff', backgroundColor: 'blue' }}
...但是color 和backgroundColor 在括号内不起作用。
我尝试做的一件事是将 <NavDropdown> 元素包装在样式 div 中,但这会打乱导航栏元素的对齐方式。
【问题讨论】:
-
我在 devtools 中看到样式被默认重写了应用于链接文本的 css。
标签: css reactjs twitter-bootstrap-3 react-bootstrap