码迷,mamicode.com
首页 > Web开发 > 详细

css3-实现水平垂直居中

时间:2020-02-20 22:25:46      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:class   html   垂直   radius   oct   pos   ack   doctype   居中   

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>实现水平垂直居中</title>
	<style type="text/css">
         .content {
         	width: 100px;
         	height: 100px;
         	background: yellow;
         	position: absolute;
         	top: 50%;
         	left: 50%;
         	border-radius: 5px;
         	transform: translate(-50%,-50%);
         }

	</style>
</head>
<body>
	<div class="content"></div>
</body>
</html>

  

css3-实现水平垂直居中

标签:class   html   垂直   radius   oct   pos   ack   doctype   居中   

原文地址:https://www.cnblogs.com/youzhishusheng/p/12337496.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!