<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<style>
*{margin:0;padding:0;}
.box{
width:300px;height:100px;background:red;
position:fixed;
left:0px;
right:0px;
top:0px;
bottom:0px;
margin:auto;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
css 定位元素上下左右居中
猜你喜欢
转载自blog.csdn.net/Misnice/article/details/104514315
今日推荐
周排行