css让容器水平垂直居中的7种方式(3)
发布时间:2020-03-16 04:35 所属栏目:52 来源:站长网
导读:}/**方法一**/.center{background:green;position:absolute;width:100px;height:100px;left:50px;top:50px; }/**方法二**/.center{background:green;position:absolute;width:100px;height:100px;left:50%;top:50%;
} /**方法一**/ .center { background: green; position: absolute; width: 100px; height: 100px; left: 50px; top: 50px;
} /**方法二**/ .center { background: green; position: absolute; width: 100px; height: 100px; left: 50%; top: 50%; margin-left:-50px; margin-top:-50px; }
兼容性:适用于所有浏览器 (编辑:ASP站长网) |
相关内容
网友评论
推荐文章
热点阅读