我正在使用 react 构建一个网站,并为 Navbar 和 Carousel 应用了 Reactbootstrap。对于页脚 MdBootstrap。
我得到的问题是我的导航栏没有内联显示,并且导航栏和轮播上左右都有一个填充。
有人可以帮我解决这个问题吗?
这是我的 CustomNavbar.jsx 和 CustomNavbar.css:
import React, { Component } from 'react'
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import './CustomNavbar.css'
export default class CustomNavbar extends Component {
render() {
return (
<Navbar default collapseOnSelect fluid={true}>
<Navbar.Header>
<Navbar.Brand>
<Link to="/">CodeLife</Link>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
<Navbar.Collapse>
<Nav>
<NavItem eventKey={1} componentClass={Link} href="/" to="/">
Home
</NavItem>
<NavItem eventKey={2} componentClass={Link} href="/about" to="/about">
About
</NavItem>
<NavItem eventKey={3} componentClass={Link} href="/news" to="/news">
News
</NavItem>
</Nav>
</Navbar.Collapse>
</Navbar>
)
}
}
nav.navbar, .navbar-default {
background-color: #2892D7 !important;
margin-bottom: 0;
margin:0;
padding:0;
}
.navbar-default {
background-image: none;
border: none;
border-radius: 5px;
margin:0;
padding:0;
}
.navbar-default .navbar-nav > li > a {
color: white;
margin-bottom: 0;
position: relative;
display: block;
margin:0;
padding:0;
}
.navbar-default .navbar-brand {
color: white;
margin-bottom: 0;
margin:0;
padding:0;
}
.navbar-default .navbar-toggle {
border-color: white;
margin-bottom: 0;
margin:0;
padding:0;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: white;
margin:0;
padding:0;
}
.navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover {
background-color: transparent;
margin-bottom: 0;
margin:0;
padding:0;
}
.navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover {
color: white;
background-color: transparent;
margin-bottom: 0;
margin:0;
padding:0;
}
.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
color: white;
background-color: transparent;
margin-bottom: 0;
margin:0;
padding:0;
}
这里的样子: https ://imgur.com/8B13iB6