position Logo in the middle in NavBar

Related searches

I am Struggling to position the logo in the middle of navbar , and having elements spreading out from the logo on the left and right. I also want to push the buttons in the end of the nav bar.

this is the ideal positioning In my code, i tried to create two column inside the nav bar. with one taking up 80% width which stores 5 elements, and the other taking up 20% width for the buttons at the end. I am not sure which is the best way to do this.

<nav class="navbar navbar-expand-md navbar-dark bg-dark py-3">
    <ul class=" col-sm-10 navbar-nav justify-content-center">
        <li class="nav-item"><a href="#" class="nav-link">Products</a></li>
        <li class="nav-item"><a href="#" class="nav-link">My Products</a></li>

        <li><img src="../../assets/KLion.jpg" alt="logo" style="width:70px; height:50px;"></li>
        <li class="nav-item"><a href="#" class="nav-link">About KLion</a></li>
        <li class="nav-item"><a href="#" class="nav-link">News & Updates</a></li>

    </ul>
    <ul class=" col-sm-1 navbar-nav justify-content-between py-3 ">

        <button type="button" class="btn">
            <img src="../../assets/Group 1.png" alt="logo" style="width:80px; height:20px;">
        </button>
        <button type="button" class="btn">
            <img src="../../assets/shopping-cart@2x.png" alt="logo" style="width:20px; height:20px;">
        </button>
    </ul>

</nav>
.navbar-nav > li{
  margin-left: 130px;
}
.navbar{
  display:flex;
  flex-direction:row;
  justify-content:space-evenly;
  width:100%;
}
.navbar ul:first-child{
  margin-left:20%;
  display:flex;
  flex-direction:row;
  justify-content:space-between;
  width:60%;
}
.navbar ul:last-child{
  width:20%;
  display:flex;
  flex-direction:row;
  justify-content:space-evenly;
}

https://codepen.io/infasyskey/pen/jOEojEQ

Center logo in navbar Perfect Coding (Most people do it wrong way , Center logo in navbar Perfect Coding (Most people do it the wrong way). Most of the time if Duration: 10:03 Posted: Nov 20, 2018 I am trying to put my logo on the left side of the nav bar for screens 768px and up. So how do I only have my logo show up on screens 768px and up? Right now it shows up on all size screens and it also shows up in the top left hand corner and pushes the rest of the nav bar down which I dont want it to do.

I hope this will help you

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

<nav class="navbar navbar-default" role="navigation">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>    
  </div>
  <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav">
      <li class="navbar-left"><a href="#">Left 1</a></li>
      <li class="navbar-left"><a href="#">Left 2</a></li>
      <li class="active"><a href="#" class="nav-link">Products</a></li>
      <li class=""><a href="#" class="nav-link">My Products</a></li>
      <li><img src="your_img_path" alt="logo" style="width:70px; height:50px;"></li>
      <li class=""><a href="#" class="nav-link">About KLion</a></li>
        <li class=""><a href="#" class="nav-link">News & Updates</a></li>

      <li class="navbar-right"><button type="button" class="btn">
            <img src="../../assets/Group 1.png" alt="logo" style="width:80px; height:20px; ">
        </button></li>
      <li class="navbar-right"  style="margin-right: 20px;"><button type="button" class="btn">
            <img src="../../assets/shopping-cart@2x.png" alt="logo" style="width:20px; height:20px;">
        </button></li>
    </ul>
  </div>
</nav>

@media (min-width: 768px) {
  .navbar-nav {
    width: 100%;
    text-align: center;
  }
  .navbar-nav > li {
    float: none;
    display: inline-block;
  }
  .navbar-nav > li.navbar-right {
    float: right !important;
  }
}

Thanks

Centering Your Logo In the Navigation, Add the logo in Site Identity. Set the Navigation Location to Float Right. Enable the Mobile Header feature and upload a mobile header logo. Select the Menus you want to implement this method. Add a custom link and CSS class as the screenshot below: 1.) Can’t understand how to insert a logo into the navbar. I saw a code where logo was put into the container with . tag, but still can’t understand how to do it with my code. 2.) I also made my navbar-right, but can’t understand how to place my text in the middle of the navbar (so the margins from the top and bottom were the same.

You can try this, if you are expecting something similar and position it in the appropriate tag inside the style block using margin and adjust the button size using padding.

<html>
    <head></head>
<style>
    .navbar-nav > a{
        margin-left: 50px;
    }
    img{
        margin-left: 50px;
    }
</style>
    <body>
        <nav class="navbar navbar-expand-md navbar-dark bg-dark py-3">
            <div class=" col-sm-10 navbar-nav justify-content-center">
                <a href="#" class="nav-link">Products</a></li>
                <a href="#" class="nav-link">My Products</a></li>
                <img src="../../assets/KLion.jpg" alt="logo" style="width:70px; height:50px;"></li>
                <a href="#" class="nav-link">About KLion</a></li>
                <a href="#" class="nav-link">News & Updates</a></li>
                <button type="button" class="btn">
                    <img src="../../assets/Group 1.png" alt="logo" style="width:80px; height:20px;">
                </button>
                <button type="button" class="btn">
                    <img src="../../assets/shopping-cart@2x.png" alt="logo" style="width:20px; height:20px;">
                </button>
            </div>
        </nav>
    </body>
</html>

Center logo in nav header, right align other logo, I've been asked to center the logo on our header and to put our company btn- info navbar-btn"> <i class="glyphicon glyphicon-align-center"></i> You could do the same without flex and absolutely position the left and right� <div class=”navbar-header”> <!--Navbar--> <nav class="navbar navbar-toggleable-md navbar-light fixed-top scrolling-navbar"> <div class="container"> <button class="navbar-toggler navbar-toggler-right hidden-md-up pull-right" type="button" data-toggle="collapse" data-target="#navbarNav1" aria-controls="navbarNav1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="default.htm"> <img src="images/KVW-52-red

Problem positioning logo in the middle of navigation links, I am new to CSS and have a hard time positioning Logo(link) at the center of . nav { list-style:none; margin:0; padding:0; position:relative; text-align:center;� The following CSS code of the navbar-center class will align the menu or text content to the center position in Bootstrap navbar..navbar-nav.navbar-center { position: absolute; left: 50 %; transform: translatex(-50 %); } Our example code aligns the menu in three positions on Bootstrap navbar like the below.

How To Create Centered Menu Links, Learn how to create a navigation bar with a centered link/logo. position: relative; background-color: #333; overflow: hidden; text-align: center; padding: 14px� After changing the height to auto, the logo position moved more toward the top of the navbar instead of being in the middle. gandalf458 October 26, 2016, 6:11pm #5

In this article, we will align the navbar to the right in two different ways, below both the approaches are discussed with proper example. Example 1: In the first example, we use the .ml-auto class of Bootstrap 4 to align navbar items to the right. The .ml-auto class automatically gives a left margin and shifts navbar items to the right. Program:

Comments
  • I didnt notice that...thanks for the edit @rajat.gite