我试图在 div 内创建 DIV。但我在将 div 居中时遇到问题。我跟着 How to horizontally center a <div> in another <div>?
使用上述问题中建议的方法,DIV 水平居中,而不是垂直居中。 http://jsbin.com/oyemu4
目前我使用的是 margin-top: 20%。请建议其他垂直居中的方法。另一个问题,我们可以用百分比表示不透明度吗?
最佳答案
为了不透明,支持交叉浏览
filter: alpha(opacity=70);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
-moz-opacity: 0.70;
opacity:0.7;
垂直对齐替代方案
div{
height:200px;
line-height:200px;
/*dont need vertical alignment in this case*/
}
关于css - 如何在另一个DIV中创建一个DIV?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3796640/