博主信息
博文 23
粉丝 0
评论 1
访问量 19813
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
前端基础-css盒子模型、定位操作(2018年8月16日)
大白鲸的博客
原创
949人浏览过

作业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>

运行实例 »

点击 "运行实例" 按钮查看在线实例


批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

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

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学