Ivan Ivan - 14 days ago 8
CSS Question

Bootstrap Navbar height as logo

I've created a navbar with a logo but the logo is out of place (see image). I know how to shrink the image so it fits the navbar, but I want to increase the height of the navigation bar so that it matches the logo.

enter image description here

This is my code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title> Mobtech </title>

<!--Ubaci bootstrap css -->
<link rel="stylesheet" href="css/bootstrap.min.css">

</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-container">
<span class="sr-only"> Pokazi i sakrij navigaciju </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img src="Slike/logo.png" alt="LogoSlika"/>
</a>
</div>
<div class="collapse navbar-collapse" id="navbar-container">
<ul class="nav navbar-nav">
<li class="active"><a href="#"> Početna strana </a> </li>
<li><a href="#"> Privatni korisnici </a> </li>
<li><a href="#"> Poslovni korisnici </a> </li>
<li><a href="#"> Uređaji </a> </li>
<li><a href="#"> O Nama </a> </li>
</ul>
</div>
</div>
</nav>

<br />
<!-- JavaScript fajl -->
<script src="js/jquery.min.js"></script>
<!-- Kompresovan JavaScript fajl -->
<script src="js/bootstrap.min.js"></script>

</body>
</html>


I don't have my custom CSS. Do I need to create it ? I'm new to bootstrap.

Answer

As simple as that: add this line near including boostrap.min.css

<link rel="stylesheet" href="css/style.css">

Create a new file named style.css in css folder, and add this lines in it.

.navbar-default .navbar-nav>li>a  {
    padding: 20px 15px 20px 15px;
}
.navbar-default .navbar-brand {
    padding-top: 0px;
}

I've tested it and worked for me 100%.

Comments