如何垂直对齐此导航栏?

时间:2016-11-05 12:43:35

标签: html css navbar vertical-alignment

我有一个导航栏,但我不知道如何垂直对齐某些类。 我用bootstrap。导航栏是固定位置。导航栏分为3行。搜索行没问题,但我无法垂直对齐其他行。

这是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>

这是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;
}

那么,我如何垂直对齐徽标和cim类?

1 个答案:

答案 0 :(得分:1)

试试这个: -

o = 6