Bootstrap 3 : Vertically Center Navigation Links when Logo Increasing The Height of Navbar

后端 未结 6 774
说谎
说谎 2020-12-07 20:32

I\'m new to the bootstrap framework.

Logo Increasing Height of NavBar:

In my navigation bar, I have inserted a logo that has a height of 50p

6条回答
  •  执笔经年
    2020-12-07 21:14

    I found that you don't necessarily need the text vertically centred, it also looks good near the bottom of the row, it's only when it's at the top (or above centre?) that it looks wrong. So I went with this to push the links to the bottom of the row:

    .navbar-brand {
        min-height: 80px;
    }
    
    @media (min-width: 768px) {
        #navbar-collapse {
            position: absolute;
            bottom: 0px;
            left: 250px;
        }
    }
    

    My brand image is SVG and I used height: 50px; width: auto which makes it about 216px wide. It spilled out of its container vertically so I added the min-height: 80px; to make room for it plus bootstrap's 15px margins. Then I tweaked the navbar-collapse's left setting until it looked right.

提交回复
热议问题