html - 居中后 Div 大于 Content

标签 html css twitter-bootstrap

经过 1 小时的尝试和错误并搜索此类问题后,我尝试在此处获得答案。

我想将 Bootstrap 导航栏包含到 Div 中。我将导航栏居中,但现在我的 Div 高于内容。此问题仅在导航栏居中时出现。如果我让它向左浮动,则导航栏下方的空间不存在。

我觉得应该是

ul{     
    display: inline-block;
}

这就是我所拥有的。

Menu centered but to much space below

这就是我想要的,只是居中:

No space below but centered left

希望你能帮助我:)

最佳答案

.nav 中使用 vertical-align: top; 希望这能解决您的问题

updated working code

关于html - 居中后 Div 大于 Content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30889863/

相关文章:

html - 如何将滑行箭头放在滑行轨道之外

html - 在 Bootstrap 模式中将文本区域宽度设置为 100%

jquery - 这是什么效果,如何制作? (淡入导航栏和滚动元素)

html - 响应式设计不适用于文本

javascript - HTML 中的表单标签提交与 JS 中的 document.getElementById ("form1").submit()

ie8 中的 css 分页符(iframe)

javascript - 将变量值而不是其名称作为类传递

html - 为没有空标签的链接添加大背景图片

javascript - 我怎样才能在 Twitter Bootstrap 中有两个不同的模式

css - Bootstrap 3,Chrome 中的三列固定布局中断