<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>当div为position: fixed自适应居中</title>
<style>
.fixed {
width: 300px;
height: 150px;
background-color: red;
position: fixed;
top: 20%;
left: 0;
right: 0;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="foxed">
fixed浮动居中
</div>
</body>
</html>
当div为position: fixed自适应居中
猜你喜欢
转载自my.oschina.net/u/3803573/blog/2878911
今日推荐
周排行