综合技术

CSS: Inline-Display: Using DIV Why do I get space on the 2nd DIV?

微信扫一扫,分享到朋友圈

CSS: Inline-Display: Using DIV Why do I get space on the 2nd DIV?
0

Pretty simple page. Want to use inline-display instead of float. Set this up a few times now, but, for some reason on this page it’s dropping down the menu div when I set the height of the logo div.

demo at jsfiddle

HTML

CSS

#topbar {
    width: 100%;
    max-width: 1000px;
    margin: auto;
}
#topbar .item {
    line-height: 91px;
    display: inline-block;
    background-color: #063;
}
#topbar #logo {
    background-image: url(../img/logo.png);
    background-repeat: no-repeat;
    width: 30%;
    height: 91px;
}
#topbar #menu {
    width: 60%;
}

Probably simple solution or simple error from my side but cannot see it.

Use vertical-align:top
on the menu and it should look good. Making your styles for the #menu
the following:

#topbar #menu {
    width: 60%;
    vertical-align: top;
}

Here’s a demo

阅读原文...

Hello, buddy!

Why does not the background image appear in Jumbotron (Bootstrap)?

上一篇

利用聊天机器人简化金融注册流程,Jirnexu获1100万美元B轮融资

下一篇

您也可能喜欢

评论已经被关闭。

插入图片
CSS: Inline-Display: Using DIV Why do I get space on the 2nd DIV?

长按储存图像,分享给朋友