1
I have the following buttons on my navbar:
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="~/Painel/Index" style="padding:5px">
<img width="90" height="40" alt="" src="..." />
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav" id="ulTelas">
<li><a href="/HorasPendencia/HorasPendencia">Horas Pendências</a></li>
<li><a href="#">Aferições</a></li>
<li><a href="#">Índice OCR</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<div class="btn-group ex" data-toggle="buttons" style="vertical-align:middle">
<label class="btn btn-primary btn-sm">
<input type="radio" name="options" id="blocos" value="blocos"> <span class="glyphicon glyphicon-th"></span>
</label>
<label class="btn btn-primary btn-sm">
<input type="radio" name="options" id="lista" value="lista"> <span class="glyphicon glyphicon-align-justify"></span>
</label>
</div>
<a class="btn btn-success btn-sm" id="infopopover" rel="popover" data-style="primary"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a>
<input type="hidden" id="modoexibicao" />
<input type="hidden" id="contratocod" />
@Html.Partial("_LoginPartial")
</ul>
</div>
</div>
</div>
They are being exhibited as follows:
I would like them to be aligned in the center of the navbar. What to do ?
I’ve published a rather broad response, although you post your html code and say you’re using bootstrap, there’s still some information missing such as css, question of the heights of the elements, if responsive support, etc. if you want something more defined just comment here with this information and I edit my reply ^^
– Aldo Fernandes Junior
Aligning elements vertically is often complicated or requires a fixed layout. But if you’re using flexbox it’s very simple: just use the property
align-items: center
.– rodorgas
@Aldofernandesjunior put the entire div of my navbar. I hope I helped
– Raphael Prado de Oliveira
@Raphaelpradodeoliveira Opa beauty, so I was able to put the test there with his own navbar :). I’ve edited the answer, I hope it helped :)
– Aldo Fernandes Junior