我想居中对齐cen
另一个 div() 内的 div( imp
)
这是代码示例
.imp
{
width:100%;
height:100%;
background-color: black;
position: fixed;
top:0;
bottom:0;
}
上面是主要的 div 现在应该是中心的 div 在下面给出
.cen
{
margin-left:auto;
margin-right:auto;
padding:5px;
width:auto;
height:auto;
}
这是我的问题如何.cen
与浏览器的中间对齐?有margin-left:auto; 边距右:自动;带到中心但不是从顶部。我已经将顶部设置为 50%,左侧设置为 50%,然后我也无法将其居中对齐,因为里面的内容.cen
更大,所以它出现在窗口的右下角。任何线索或想法?