Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Navbar

Hello everyone,

I want to wrap my logo into my navbar just as I have done to my glyphicons? Can anybody help me with this it will be much appreciated. Thanks.

Here is the HTML:

<!DOCTYPE html>

<html lang="en">


<head> 
       <title> </title> 

       <meta charset="utf-8">

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

       <!-- Latest compiled and minified CSS -->
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

       <link type="text/css" rel="stylesheet" href="stylesheet2.css"/>  
</head>

<body>
       <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="container">
                  <div class="navbar-header">

                      <ul class="nav navbar-nav navbar-left">
                        <li><a href="dashboard.html"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
                        <li><a href="settings.html"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a></li>
                      </ul>

                        <ul class="#"><li><a href=#><img src="munchlogoweb(1).png">
                    </img></a></li></ul>

                      <ul class="nav navbar-nav navbar-right">
                        <li><a href="help.html"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a></li>
                        <li><a href="#"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></li>
                      </ul>
                </div>

        </nav>
    </body>
</html>

Here is the CSS as well:

body {
  background-color: #FFFFFF;
  padding-top: 50px;
}

.navbar.navbar-default.navbar-fixed-top {
  width: 110%;
  height: 56px;
  background-color: #FF3F34;
  margin-top: -8px;
  margin-left: 0px;

}


.nav.navbar-nav.navbar-left {
    margin-right: 200px;
    display: inline-block;
}

.nav.navbar-nav.navbar-right {
    margin-left: 360px;
    display: inline-block;
}

.glyphicon {
    font-size: 2.5em;
    display: inline-block;
    color: #ffffff;
}

 img {
  margin-top: 12px;
  margin-left: 18px;
  display: inline;
  text-align: center;
}

.container {
  margin-left: 140px;
  height: 56px;
  width: 110%;
  display: block;
}

1 Answer

Hey ! Maybe you could try to include your image in your left navbar like this :

    <ul class="nav navbar-nav navbar-left">
       <li><a href="dashboard.html"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
         <li><a href="settings.html"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a></li>
         <li><a href=""><img src="apg.jpg"></a></li>
     </ul>

Hope it helps !

Thanks, but I want to centre the logo in between the navbar left and right. Is this possible?

Maybe you can try to center the navbar elements with some margin-left on the navbar-left

I tried that and it moves my glyph icons around I would rather have them all wrapped in on div property so that I can position them wherever I want in the navbar.