HTML表格无法居中

html-css08

HTML表格无法居中,第1张

在 <div style="text-align: center">

改成<div style="margin:0 auto">就可以div 在 页面居中了

根据网友提醒 div加个宽 看你需要多大!才能居中..

<div style="margin:0 autowidth: XXX px">XXX填写你要的大小

改成这样:

<div>

    <span id="oknum" style="background:yellow">请单击开始</span>

</div>

id放在span上,效果:

这边打开的时候内容是正常显示在居中位置的。再检查是不是其他地方的样式影响到了container里面的文本吧。

.container{

height:110px

border:5px dashed #ccc

width:80%

background-color:#84AF9B

color:rgb(209,128,36)

font-family:STXinwei

align-items:center

text-align:center

line-height:110px

margin:auto

}