使用 left(or right)使网页居中,兼容性比使用margin: auto , text-align: center高, 参考下面代码:
<html>
<style>
.container{
position: absolute;
width: 80%;
left: 10%;
background: red;
}
</style>
<body>
<div class="container">
container
</div>
</body>
</html>
使用 left(or right)使网页居中,兼容性比使用margin: auto , text-align: center高, 参考下面代码:
<html>
<style>
.container{
position: absolute;
width: 80%;
left: 10%;
background: red;
}
</style>
<body>
<div class="container">
container
</div>
</body>
</html>