老师,请帮忙检查一下,谢谢
来源:2-5 编程练习
慕神8387157
2019-04-29 15:42:52
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS布局lx3.</title>
<style type="text/css">
.box{
width: 500px;
height: 200px;
margin:0 auto;
border:1px solid #aaa;
background-color: #ababab;
color: #fff;
font-weight: bolder;
position: relative;
}
.box div{
width: 200px;
height: 40px;
font-size: 16px;
text-align: center;
/*此处写代码*/
position: absolute;
top: 50%;
left: 50%;
margin-top: -20px;
margin-left: -100px;
}
</style>
</head>
<body>
<div class="box">
<div>
欢迎大家来到慕课网学习!
来到慕课网学习!
</div>
</div>
</body>
</html>
1回答
好帮手慕码
2019-04-29
同学你好!
代码效果实现的很好~
如果帮助到了你 欢迎采纳 祝学习愉快~
相似问题