Skip to main content
Inspiring
September 8, 2017
Answered

Adding logo/brand to Bootstrap Basic Navbar

  • September 8, 2017
  • 1 reply
  • 11091 views

So I've been trying to add the company logo to the new navbar of the site, but I'm having issues. I've tried several different tricks that I've read here and on other sites but nothing seems to be working. The logo is either too large and won't scale down when I try, it vanishes, etc. If someone could help me in figuring this out I'd be greatly appreciative. Here's the code I have right now (without a logo) as well as the CSS.

*HTML*

<nav class="navbar navbar-default">

 

  <!--Figure out how to make the brand logo show up-->

 

  <div class="container">

    <!-- Brand and toggle get grouped for better mobile display -->

   

<!--Navigation html-->   

    <div class="navbar-header">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myDefaultNavbar1" aria-expanded="false"> <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" href="#">Brand</a> </div>

    <!-- Collect the nav links, forms, and other content for toggling -->

    <div class="collapse navbar-collapse" id="myDefaultNavbar1">

      <ul class="nav navbar-nav">

        <li><a href="#">About</a></li>

        <li><a href="#">Customers</a></li>

       

        <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true">Services & Products <span class="caret"></span></a>

          <ul class="dropdown-menu">

            <li><a href="#">Cyber Security & Intelligence Programs Support</a></li>

            <li><a href="#">Space Operations & Control</a></li>

            <li><a href="#">C4ISR</a></li>

            <li><a href="#">Warfighter Support & Logistics</a></li>

            <li><a href="#">Weapons Systems Analysis</a></li>

            <li><a href="#">Acquisition Support</a></li>

            <li><a href="#">Test & Evaluation</a></li>

            <li><a href="#">Audio/Visual Technology Applications</a></li>

          </ul>

        </li>

        <li><a href="#">Contracts</a></li>

        <li><a href="#">News</a></li>

        <li><a href="#">Careers</a></li>

        <li><a href="#">Contact Us</a></li>

      </ul>

</div>

    <!-- /.navbar-collapse -->

  </div>

  <!-- /.container-fluid -->

</nav>

*CSS*

.navbar.navbar-default {

background-color: #FFFFFF;

border-bottom: medium solid #001689;

font-family: Atrament, "Agency FB", "Century Gothic", Arial, sans-serif;

font-size: large;

font-weight: normal;

font-variant: small-caps;

letter-spacing: 2pt;

}

.nav.navbar-nav li a {

color: #001689;

}

.dropdown-menu li a {

font-size: medium;

font-variant: normal;

letter-spacing: normal;

.row .nav.navbar-nav {

margin: 0px auto;

width: 715px;

float: none;

}

.row .navbar {

margin-bottom: 0px;

This topic has been closed for replies.
Correct answer Nancy OShea

So I tried that coding before and I couldn't get the logo to appear. I copied and pasted this code, but still had issues getting the image to appear. I adjusted the size over and over and nothing. Sometimes it will half appear and it looks like it's behind everything else on the page.

Is there a way to add it next to the navigation, perhaps in it's own section, that I'm not thinking about?


<!doctype html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>Bootstrap 3.3.7 Starter</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<!-- Latest compiled and minified Bootstrap CSS-->

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

</head>

<style>

.navbar .navbar-brand {

margin:0;

padding:0;

height: 53px;

}

</style>

<body>

<!--begin top nav bar-->

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">

<div class="container-fluid">

<div class="navbar-header">

<a class="navbar-brand" href="#"> <img src="https://dummyimage.com/215x53.png" alt="logo" title="XYZ Home"></a>

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>

</div>

<div class="collapse navbar-collapse" id="myNavbar">

<ul class="nav navbar-nav navbar-right">

<li><a href="#">MENU 1</a></li>

<li><a href="#">MENU 2</a></li>

<li><a href="#">MENU 3</a></li>

<li><a href="#">MENU 4</a></li>

<!--Site Search -->

<li class="hidden-xs" style="padding-top:10px">

<form action="#" method="get" accept-charset="utf-8">

<div id="custom-search-input">

<div class="input-group">

<input name="query" type="text" class="search-query  form-control" placeholder="Site search" required />

<span class="input-group-btn">

<button class="btn btn-default" type="submit"> <span class=" glyphicon glyphicon-search"></span> </button>

</span>

</div>

</div>

</form>

<!--End Search -->

</li>

</ul>

</div>

</div>

<!--end top nav-->

</nav>

<div class="container">

<div class="row">

CONTENT GOES HERE....

</div>

</div>

<!--latest jQuery-->

<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous">

</script>

<!--Bootstrap-->

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

</body>

</html>

1 reply

Nancy OShea
Community Expert
Community Expert
September 8, 2017

What is the height and width of your image?

Are you using SVG  or JPG/PNG?

You may need to resize the logo and adjust the height of your navbar to accommodate the image size you're working with.

.navbar-default .navbar-header .navbar-brand {

  margin: 0;

  padding: 0;

  height: 53px;  /**adjust as needed**/

}

Nancy O'Shea— Product User & Community Expert
Legend
September 8, 2017

https://forums.adobe.com/people/Nancy+OShea  wrote

What is the height and width of your image?

Are you using SVG  or JPG/PNG?

You may need to resize the logo and adjust the height of your navbar to accommodate the image size you're working with.

.navbar-default .navbar-header .navbar-brand {

  margin: 0;

  padding: 0;

  height: 53px;  /**adjust as needed**/

}

What happens when the client says. Hey buddy I need my logo 4 times as big, as most do. The Bootstrap design never works. You get left with a daft looking naviagtion with huge amounts of space top/bottom.

I guess they really were not thinking about the design aspect when building the framework.

Nancy OShea
Community Expert
Community Expert
September 8, 2017

If the client wants a prominent logo, I don't put it in the navbar.  I also prefer to work with scalable vector graphic logos because they retain good image quality when re-scaled.   JPGs & PNGs not so much.

Nancy

Nancy O'Shea— Product User & Community Expert