无法将Nav Div居中 [英] Can't Center Nav Div

查看:293
本文介绍了无法将Nav Div居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我查看了StackOverflow上的各种文章,以解决将div居中的问题.解决方案似乎是:

Okay, so I've looked at various posts on StackOverflow addressing the problem of centering a nav div. The solution seems to be:

.menu {
  text-align: center;
}

但是,无论是围绕div的div环绕,我都将其用于任何操作.您可以在 http://www.dustinlee.co

But no matter what div wrapping around the nav I use this on it does nothing. You can see the problem at http://www.dustinlee.co

我正在使用以下框架: https://github.com/jbckmn/naked-wordpress

I'm using this framework: https://github.com/jbckmn/naked-wordpress

请注意,导航栏位于左侧.更奇怪的是,当您调整窗口大小时,它几乎开始居中.

Notice the navigation is on the left hand side. Even more strange, when you resize the window it begins to almost to the center.

更令人困惑的是它包裹在其中:

Adding even more to my confusion is the fact that it's wrapped in this:

<nav class="site-navigation main-navigation">

似乎与样式无关.

推荐答案

将此添加到您的CSS

add this to your css

header nav ul{display:inline-block;}

这篇关于无法将Nav Div居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆