1

My NavBar NavItem displays vertically but I’m trying to display it horizontal. I’m not sure where I messing up. Please let me know if you have any thought on it. Thanks! This is my code:

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 inverse collapseOnSelect>
      <Navbar.Header>
          <Navbar.Brand>
            <Link to='/'>Tsarong </Link>
          </Navbar.Brand>
            <Navbar.Toggle />
          </Navbar.Header>
      <Navbar.Collapse>

      <Nav>
            <NavItem eventKey={1} href="/">
              Home
            </NavItem>
            <NavItem eventKey={2} href="/main">
              Main
            </NavItem>
            <NavItem eventKey={3} href="/contact">
              Contact
            </NavItem>
            <NavItem eventKey={4} href="/about">
              About
            </NavItem>
            <NavItem eventKey={5} componentClass={Link} to="/topics">
              Topic
            </NavItem>
      </Nav>
      </Navbar.Collapse>
  </Navbar>
    )
  }
}

Thank you so much for your time!

1 Answer 1

2
<Nav style={{display:"flex", flexDirection:"row"}}>
...
</Nav>
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your help! It works! I really appreciate your time. Is there any documentation that I can customize the React-bootstrap? Now the height of my Navbar is too large because I having trouble to float the logo to the left and resize the Navbar.Brand.
Here I am using just the CSS. It has nothing to do with React-bootstrap. for some refs: css-tricks.com/snippets/css/a-guide-to-flexbox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.