当前位置:K88软件开发文章中心编程语言Css/Css3Css/Css301 → 文章内容

Firefox中居中的方法

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:49:44

IE中的横向居中的解决方法:是style中加上text-align

以下内容为程序代码 以下内容为程序代码

<
body style="
text-align:center
"
>

<
div style="
width:200px
height:50px
background-color:
#999999
"
>

<
/div>

<
/body>


但这个居中在火狐中没有效果,上面的黑色方块依旧在左右,因为火狐中的居中不是使用text-align,要使用magin:0 auto
如:
以下内容为程序代码 以下内容为程序代码

<
body style="
text-align:center
"
>

<
div style="
width:200px
height:50px
background-color:
#999999
margin:0 auto
"
>

<
/div>

<
/body>



Firefox中居中的方法