我希望具有与pills样式相同的外观,但没有圆角

这就是我到目前为止

<style type="text/css">{`
.nav-pills > li + li {
    border-radius: 0 !important;
}
`}</style>
<Nav
     bsStyle="pills"
     justified
     activeKey={this.props.currentStep}
     onSelect={this.updateCurrentStep.bind(this)}
>
    <NavItem eventKey={1} title="Template">Template</NavItem>
    <NavItem eventKey={2} title="Edit">Edit</NavItem>
    <NavItem eventKey={3} title="Preview">Preview</NavItem>
</Nav>


如何将border-radiusNavItem设置为0?它确实出现在li项的规则中,但不会改变任何内容。

最佳答案

在样式文件中,您可以提供:

.nav-pills>li>a {
    border-radius: 0 !important;
}


应该将边框半径的样式重置为0。



const Nav = ReactBootstrap.Nav;
const NavItem = ReactBootstrap.NavItem;

class App extends React.Component {
  render() {
    return (
      <Nav
          bsStyle="pills"
          justified
          activeKey={this.props.currentStep}
          onSelect={this.updateCurrentStep}
      >
          <NavItem eventKey={1} title="Template">Template</NavItem>
          <NavItem eventKey={2} title="Edit">Edit</NavItem>
          <NavItem eventKey={3} title="Preview">Preview</NavItem>
      </Nav>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

.nav-pills>li>a {
    border-radius: 0 !important;
}

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap/0.32.1/react-bootstrap.js"></script>

<div id="app"></div>

关于javascript - React-Bootstrap-NavItem上没有圆 Angular ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51042473/

10-16 10:47