Center image in nav menu bar
How do I Center an image in the Menu bar? When I talk about centralizing, I mean not the image in the middle of the bar, but in whatever position it is, which has the same "measures" for the top and for the bottom. How do I define this in my css
? Below is the code of my menu. I would like the image to be before the "name of my company" and not after, as it is.
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<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>
<img src="~/Images/Logomarca_mini.jpg" />
@Html.ActionLink("Nome da Minha Empresa", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
5
Author: celsomtrindade, 2015-05-22
2 answers
Set the elements at the same level as the image with display: inline-block
and line-height with the same size as the container
Http://jsfiddle.net/4hr29t6w/2 /
To get the button right, in the example set a height and margins according to the size of the container
1
Author: igrossiter, 2015-05-22 19:41:21
Here solved:
.....
</button>
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="~/Images/Logomarca_mini.jpg">
</a>
</div>
.....
1
Author: pnet, 2015-05-26 15:34:54