<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.box {
width: 200px;
height: 200px;
background-color: #f0f0f0;
/* 绝对定位,左边偏移宽度50%,顶偏移高度50% */
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%); /* 相对自己宽度x、y轴减去自己宽度高
度的一半 */
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
相关文章
- 01-15Codeforces Round #635 (Div. 2) 题解(A.B.C.D)
- 01-15Educational Codeforces Round 104 (Rated for Div. 2) A~E题解
- 01-15Codeforces Round #688(Div 2) D. Checkpoints
- 01-15div 加滚动条
- 01-15Codeforces Round #346 (Div. 2) B Qualifying Contest
- 01-15Codeforces Round #370 (Div. 2) B
- 01-15QT使用painter绘制文字时的居中显示
- 01-15CF R 633 div 1 1338 C. Perfect Triples 打表找规律
- 01-15react中实现可拖动div
- 01-15Codeforces Round #633(Div.2) E. Perfect Triples