博主信息
博文 6
粉丝 0
评论 0
访问量 5204
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
8-16作业
cousin的博客
原创
912人浏览过

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>内外边距与边框</title>
<style>
.item1{
width: 300px;
height: 200px;
background-color: red;
border-top-style: solid;
border-left: 8px solid red;
border-bottom: 10px dashed yellow;
/*margin-top: 80px; 
margin-left: 40px;
margin-bottom: 30px;*/
margin: 80px 40px 30px;
padding-top: 100px;
padding-left: 50px;
}
.item2{
width: 300px;
height: 200px;
background-color: blue;
}
.item_h2{
position: absolute;
color: white;
line-height: 50px;
}
.item3{
width: 200px;
height:200px;
margin-top: 100px;
background-color: green;
text-align: center;
margin-bottom: 10px;
}
.item4{
line-height: 200px;/*垂直居中设置行高跟父元素高一样*/
}
.item5{
width: 200px;
height:200px;
margin-top: 10px;
background-color: gray;
text-align: center;
display: table-cell;
vertical-align: middle;
}
.item6{
width: 200px;
height:200px;
margin-top: 10px;
background-color: red;
display: table-cell;
vertical-align: middle;
}
.item6 .item7{
width: 100px;
height:100px;
margin-top: 10px;
background-color: yellow;
margin-left: auto;
margin-right: auto;
}
.item8{
width: 100px;
height:100px;
margin-top: 10px;
background-color: skyblue;
text-align: center;
display: table-cell;
vertical-align: bottom;
}
ul{
margin: 0;
padding-left: 0;
}
.item8 li{
display: inline;
}
</style>
</head>
<body>
<div class="item1">
<h2 class="item_h2">测试内容</h2>
</div>
<div class="item2"></div>
<div class="item3"><a class="item4" href="">元素对其方式</a></div>
<div class="item5">
<a href="">多行内敛1</a><br>
<a href="">多行内敛2</a>
</div>
<div class="item6">
<div class="item7"></div>
</div>
<div class="item8">
<ul>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
<li><a href="">5</a></li>
</ul>
</div>
</body>
</html>

运行实例 »

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


实例

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>十字架</title>
	<style>
		.box1{
			width: 50px;
			height: 50px;
			background-color: red;
			position: relative;
			left: 50px;
		}
		.box2{
			width: 50px;
			height: 50px;
			background-color: blue;
		}
		.box3{
			width: 50px;
			height: 50px;
			background-color: black;
			position: relative;
			top: -50px;
			left: 100px;
		}
		.box4{
			width: 50px;
			height: 50px;
			background-color: yellow;
			position: relative;
			top: -100px;
			left: 50px;
		}
		.box5{
			width: 50px;
			height: 50px;
			background-color: green;
			position: relative;
			top: -100px;
			left: 50px;
		}
	</style>
</head>
<body>
	<div class="box1"></div>
	<div class="box2"></div>
	<div class="box3"></div>
	<div class="box4"></div>
	<div class="box5"></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+教程免费学