请老师检查

来源:2-5 编程练习

雨豚

2020-08-02 12:11:38

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<style type="text/css">
		*{padding: 0; margin: 0;}
		.box{
			width: 500px;
			height: 200px;
			background-color: gray;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-top: -100px;
			margin-left: -250px;
		}
		.box div{
			font-family: "微软雅黑";
			font-size: 16px;
			text-align: center;
			color: #fff;
			width: 200px;
			height: 60px;
			position: absolute;
			top:70px;
			left: 150px;
		}
	</style>
</head>
<body>
	<div class="box">
		<div>欢迎大家来到慕课网学习!
		来到慕课网学习!</div>
	</div>
</body>
</html>

请问老师怎么检查是否垂直居中,如果稍微偏一点点看不出来呢?我按F12不太会看...

http://img.mukewang.com/climg/5f263cd509f21a9c13570610.jpg


写回答

1回答

好帮手慕码

2020-08-02

同学你好,代码效果正确。另,检查是否居中可以通过:测试下图中两个箭头的高度是否相等(可以利用截图工具)。

http://img.mukewang.com/climg/5f26530209919d5809940988.jpg

祝学习愉快~

0

0 学习 · 40143 问题

查看课程