批改状态:合格
老师批语:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css align</title>
<style type="text/css">
.box1 {
width: 500px;
height: 100px;
text-align: center;
background-color: lightblue;
}
.box1 h3 {
line-height: 100px;
}
.box2 {
width: 500px;
height: 300px;
font-size: 1.01em;
display: table-cell;
vertical-align: middle;
background-color: lightcyan;
background-image: url("./img/lightcolor.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.box2 p {
margin:auto;
text-align: center;
}
.box3 {
width: 500px;
height: 100px;
background-color: lightyellow;
text-align: center;
display: table-cell;
vertical-align: middle;
}
.box3 a {
text-decoration: none;
}
.box3 a:hover {
text-decoration: underline;
font-size: 1.04em;
color: blue;
}
.box4 {
width: 500px;
height: 200px;
background-color: lightgreen;
text-align: center;
display: table-cell;
vertical-align: bottom;
}
.box4 li {
list-style: none;
display: inline;
}
.box4 ul {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<!-- 单行文本对齐 -->
<div class="box1">
<h3 class="title">php</h3>
</div>
<hr>
<!-- 块元素对齐 -->
<div class="box2">
<p id="para">
坐倚狮峰涛渐起,<br>
晚看流云景愈奇。<br>
漫山松翠连天碧,<br>
瞬息如海满谷底。<br>
</p>
</div>
<hr>
<!-- 多行文本对齐 -->
<div class="box3">
<a href="">2013.5</a><br>
<a href="">2014.6</a><br>
<a href="">2015.3</a><br>
</div>
<hr>
<!--不定宽块元素对齐 -->
<div class="box4">
<ul class="item">
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
</ul>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
图片:


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