小编Mat*_*att的帖子

在 react-bootstrap 中更改 NavDropdown 的颜色和背景颜色

使用NavDropdownin react-bootstrap,我无法设置其颜色或背景颜色的样式...

<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>
Run Code Online (Sandbox Code Playgroud)

我可以使用 更改字体大小style={{ fontSize: '130%' }},但我还想使用 ..

style={{ fontSize: '130%', color: '#fff', backgroundColor: 'blue' }}

...但color并backgroundColor没有在括号内工作。

我尝试做的一件事是将<NavDropdown>元素包装在一个 style 中div,但这会弄乱 Navbar 元素的对齐方式。

css reactjs twitter-bootstrap-3 react-bootstrap

5
推荐指数
2
解决办法
1万
查看次数