<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style> .box{
width: 440px;
height: 500px;
background-color: #ccc;
overflow: hidden;
position: relative;
}
.son{
width: 200px;
height: 100px;
background-color: red;
margin: auto;
position: absolute;
/*定位:参照的是父容器*/
left: 50%;
top: 50%;
/*偏移:偏移中的百分比参照的是自身*/
/*定位加变化是解决居中垂直对齐问题的神器、*/
transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<div class="box">
<div class="son"></div>
</div> </body>
</html>

最新文章

  1. javascript超过容器后显示省略号效果(兼容一行或者多行)
  2. ABAP 订单转交货单
  3. Lucene4.1 视频学习
  4. cacti yum快速部署
  5. 一种无new创建对象的方法
  6. VC编程中如何设置对话框的背景颜色和静态文本颜色
  7. Java 里把 InputStream 转换成 String 的几种方法
  8. Git 怎么创建本地库,向本地库提交文件
  9. 【转载】linux环境下为firefox/chrome浏览器安装flash player
  10. 专业运维配的vsftpd.conf
  11. Linux基础命令归纳大全
  12. js 两数的最大公约数
  13. [GNU] 喝一杯咖啡, 写一写 Makefile
  14. Go语言规格说明书 之 select语句(Select statements)
  15. Codeforces Round #322 (Div. 2) E F
  16. 【Python算法】遍历(Traversal)、深度优先(DFS)、广度优先(BFS)
  17. springboot email 中常量值 配置 mailUtils
  18. CVE-2017-7269—IIS 6.0 WebDAV远程代码执行漏洞分析
  19. 对于GTPv1协议头部的解析
  20. 解析 Ceph: FileJournal 的作用

热门文章

  1. struts2文件上传,文件类型 allowedTypes对应
  2. [NOIP2019模拟赛]LuoguP4261白金元首与克劳德斯
  3. 虚拟机上CentOS7 配置NAT模式
  4. Joomla - T3模板(非常好用的4屏响应式模板)
  5. php结合phpStudy实例来熟悉CI框架,用的软件是phpStorm+phpStudy
  6. opencv-VS2010配置opencv2.4.8
  7. C++数组或vector求最大值最小值
  8. Android基础控件RatingBar星级评分条的使用
  9. 分布式锁的Redis实现
  10. MySQL-Utilities:mysqldbcompare及跳过复制错误