0

I'm having some issue with my navigation bar. It turns out like this:

enter image description here

But I want it too look like this:

enter image description here

The code looks a little like this:

<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
  <div class="container topnav">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="##bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        </button>
      <a class="navbar-brand topnav" href="#" target="_blank">Name</a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">

        <li><a href="#home">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#portfolio">Portfolio</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </div>
  </div>
</nav>
4
  • 1
    create a code snippet, also mention if you are using BS 3/4 Commented May 21, 2018 at 19:19
  • Share the css properties you are using, so that we can check and provide better solution. Commented May 21, 2018 at 19:19
  • You need to make them inline, use CSS. Also provide a snippet, or at least the CSS Commented May 21, 2018 at 19:20
  • It appears you are using Twitter Bootstrap. You need to tag the question as such, and be sure to clarify if you are using 3 or 4. If you are NOT using bootstrap, then you need to include your css. Commented May 21, 2018 at 19:24

1 Answer 1

1

This is a plain CSS implementation with flexbox wihtout knowing your other CSS stuff:

.navbar > .container{
  display:flex;
  flex-flow:row wrap;
  justify-content: space-between; 
}
.navbar-right{
  display:flex;
  flex-flow:row wrap;
  justify-content: flex-end; 
}
.navbar-right li{
  list-style:none;
}
.navbar a{
  display:block;
  padding:0.3em 1em 0.5em 1em;
}
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
  <div class="container topnav">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="##bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        </button>
      <a class="navbar-brand topnav" href="#" target="_blank">Name</a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">

        <li><a href="#home">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#portfolio">Portfolio</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
  </div>
</div>
</nav>

Sign up to request clarification or add additional context in comments.

Comments

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.