Peter6528 Peter6528 - 3 days ago 5
CSS Question

How can I vertically align this navigation bar?

I have a navigation bar, but i don't know how to vertically align some classes.
I use bootstrap. The navigation bar is fixed position. The navbar is divided into 3 row. The search row is OK, but I can't vertically align the another rows.

Here is the HTML:










<div class="col-sm-10" >
<p>Reményik Tudástár</p>
</div>
</div>
</div>
</div>

<div class="col-sm-4 navbar-search vertical-align">
<div class="container-fluid">
<div class="row vertical-align">
<div class="col-sm-1"></div>
<div class="col-sm-9" style="padding: 0;">
<input type="text" name="search" class="navbar-search-input" placeholder="Keresés">
</div>

<div class="col-sm-1" style="">
<button class="navbar-search-button"><i class="fa fa-search"></i></button>
</div>
<div class="col-sm-1"></div>
</div>
</div>
</div>

<div class="col-sm-4 navbar-login" style="">
<div class="container-fluid">
<div class="row">
<div class="col-sm-10">
<p style="float: right;">Bejelentkezés</p>
</div>

<div class="col-sm-2">
<span class="fa fa-sign-in fa-2x"></span>
</div>
</div>
</div>
</div>
</div>




and here is the CSS:

.navigation-bar {
background-image: url("../img/nav_background.png");
padding: 15px;
box-shadow: 0px 2px 5px #999999;
}

.navbar-search-input {
width: 100%;
border: 0;
border-radius: 3px 0 0 3px;
height: 35px;
padding: 10px;
}

.navbar-search-button {
background-color: #203138;
color: #fff;
margin-right: 100%;
border: 0;
border-radius: 0 3px 3px 0;
height: 35px;
padding-left: 12px;
padding-right: 12px;
}


So, how can I vertically align the logo and the cim class?

Answer

Try this:-

display: inline-block;
    *display: inline;
    vertical-align: middle;
Comments