Blogger Information
Blog 9
fans 0
comment 0
visits 7715
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
用绝对定位实现十字
漠漠
Original
665 people have browsed it

实例

<!DOCTYPE html>
<html>
<head>
	<title>用绝对定位实现块级元素十字排布</title>
	<meta charset="utf-8">
</head>
<style type="text/css">
	body{
		margin:0;
		background: coral;
		position: relative;
	}
	
	.box1{
		width: 200px;
		height: 200px;
		background: lightblue;
		text-align:center;
		line-height:200px;
		position:absolute;
		left:200px;
	}
	.box2{
		width: 200px;
		height: 200px;
		background: lightgreen;
		text-align:center;
		line-height:200px;
		position:absolute;
		left:400px;
		top:200px;

	}
	.box3{
		width: 200px;
		height: 200px;
		background: lightcoral;
		text-align:center;
		line-height:200px;
		position:absolute;
		left:200px;
		top:400px;
	}
	.box4{
		width: 200px;
		height: 200px;
		background: lightgray;
		text-align:center;
		line-height:200px;
		position:absolute;
		top:200px;
	}
	.box5{
		width: 200px;
		height: 200px;
		background: wheat;
		text-align:center;
		line-height:200px;
		position:absolute;
		left:200px;
		top:200px;
	}
</style>
<body>
	<div class="box1">1</div>
	<div class="box2">2</div>
	<div class="box3">3</div>
	<div class="box4">4</div>
	<div class="box5">5</div>
</body>
</html>

运行实例 »

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


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post