批改状态:合格
老师批语:
作业1:
盒子模型基本元素:内容(content)、外边距(margin)、边框(border)、内边距(padding)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>盒子模型的元素实例</title>
<style type="text/css">
.box{
width: 300px;
height: 300px;
background-color: yellow;
margin: 20px;
border: 20px solid lightblue;
border-radius: 10px;
text-align: center;
}
.box a{
line-height: 300px;
font-size: 25px;
}
</style>
</head>
<body>
<div class="box"><a href="">我是盒子模型</a>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
作业2:
四种常用的定位操作实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>盒子模型的元素实例</title>
<style type="text/css">
.box{
width: 300px;
height: 300px;
background-color: yellow;
text-align: center;
}
.box a{
line-height: 300px;
font-size: 25px;
}
.box2{
width: 300px;
height: 300px;
background-color: lightblue;
text-align: center;
display:table-cell;
vertical-align: middle;
}
</style>
</head>
<body><h2>1.行内子元素居住设置</h2>
<div class="box"><a href="">我是盒子模型</a>
</div>
<hr>
<h2>2.多行文本子元素居住设置</h2>
<div class="box2">
<span>我是多行文本居住</span><br>
<span>我是多行文本居住</span>
</div>
<hr>
<h2>3.块级子元素居住设置</h2>
<div class="box2">
<span>我是多行文本居住</span><br>
<span>我是多行文本居住</span>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
作业3:
css定位操作绝对定位制作十字型块级实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>盒子模型的相对定位实例</title>
<style type="text/css">
body{
margin: 0;
}
.box{
width: 600px;
height: 600px;
background-color: #888;
position: absolute;
}
.box1{
width: 200px;
height: 200px;
background-color: lightcoral;
position: absolute;
left: 200px;
top: 0px;
}
.box2{
width: 200px;
height: 200px;
background-color: lightgreen;
position: absolute;
top: 200px;
left: 400px;
}
.box3{
width: 200px;
height: 200px;
background-color: lightblue;
position: absolute;
left: 200px;
top: 400px;
}
.box4{
width: 200px;
height: 200px;
background-color: lightpink;
position: absolute;
left: 0px;
top: 200px;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号