Html Firefox没有';我不喜欢flex-box型号的margin auto
我正在尝试将标题>部分居中。它可以与chrome和opera配合使用,但firefox将其推到左侧。我创建了一个名为Html Firefox没有';我不喜欢flex-box型号的margin auto,html,css,Html,Css,我正在尝试将标题>部分居中。它可以与chrome和opera配合使用,但firefox将其推到左侧。我创建了一个名为.body的类,其宽度为960px,边距为0 auto。它无法识别firefox上的margin:0 auto(我使用的是Firefox18) 我已尝试将body类的显示值设置为内联块。它确实居中,但它将导航推到底部(适用于所有浏览器) 这就是我想做的 HTML <header id="header"> <section class="body box">
.body
的类,其宽度为960px,边距为0 auto。它无法识别firefox上的margin:0 auto
(我使用的是Firefox18)
我已尝试将body
类的显示
值设置为内联块
。它确实居中,但它将导航推到底部(适用于所有浏览器)
这就是我想做的
HTML
<header id="header">
<section class="body box">
<section class="flex1">
<a>MyWebsiteName</a>
</section>
<nav class="nav-list flex1">
<ul>
<li>
<a href="">Login</a>
</li>
<li><a href="">Register</a></li>
<li><a href="">Help</a></li>
</ul>
</nav>
</section>
这是改变
页边距的位:0自动代码>:
.box {
display: -moz-box;
}
如果您只留下
,它可以正常工作 答案并不完美,但相当方便
就个人而言,我对浏览器开发团队(Microsoft、Mozilla等)在为其应用程序规划HTML界面时表现不佳感到失望。W3C还不能对这些公司强制执行:这是我们的一个主要缺点,现在快到2014年了,仍然存在这些可笑的咕噜级问题。做了十年的生意,我有点心烦。请看下面的答案。。。(相应地设置宽度)
回答
<style type="text/css">
.box_wrap{margin:0 auto;width:50%;}
</style>
<div class="box_wrap">
<div class="your_flex_box"> ... </div>
</div>
.box_wrap{边距:0自动;宽度:50%;}
...
您是否尝试仅使用
?如果不使用该选项,则会将其置于中间位置,但会将ul
列表向下推。您希望您的ul
显示在哪里?我正在尝试水平对齐它们
<style type="text/css">
.box_wrap{margin:0 auto;width:50%;}
</style>
<div class="box_wrap">
<div class="your_flex_box"> ... </div>
</div>