批改状态:合格
老师批语:
代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.box{
width: 200px;
height: 200px;
background: red;
text-align: center;/*使行内元素在块元素中水平居中*/
}
.box p {
line-height: 200px;
}
.box1 {
width: 200px;
height: 200px;
text-align: center;
background: green;
display: table-cell;/*将当前块显示方式改为表格单元格方式*/
vertical-align: middle;/*设置单元格内元素垂直居中*/
}
.box2 {
width: 200px;
height: 200px;
background: yellow;
display: table-cell;
vertical-align: middle;
}
.box2 .pad{
width: 100px;
height: 100px;
background: red;
margin: auto;/*auto 指用浏览器自动计算位置*/
}
.box3 {
width: 200px;
height: 200px;
background: blue;
display: table-cell;
vertical-align: middle;
}
.box4{
width: 200px;
height: 200px;
background: skyblue;
display: table-cell;
vertical-align: bottom;
text-align: center;
}
.box4 ul {
padding-left: 0;
}
.box4 li {
list-style: none;
display: inline;
}
</style>
</head>
<body>
<div>
<p>这是一行元素</p>
</div>
<br><br>
<div>
<span>这是多行元素</span>
<br>
<span>这是多行元素</span>
</div>
<br>
<div><div></div></div>
<br>
<div>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>
</body>
</html>手抄代码

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号