Blogger Information
Blog 34
fans 0
comment 0
visits 26563
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
绝对定位的简单应用
罗盼的博客
Original
649 people have browsed it

实例

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>绝对定位</title>
		<style>
		
			.box{
				width: 300px;
				height: 300px;
				
				
			}
			.box1{
				width:100px;
				height:100px;
				background-color:red;
				position: absolute;/*绝对定位,当前父元素为box*/
				top:0;
				left:100px;
			}
			.box2{
				width:100px;
				height:100px;
				background-color:green;
				position: absolute;/*绝对定位,当前父元素为box*/
				top:100px;
				left:200px;
			}
			.box3{
				width:100px;
				height:100px;
				background-color:blue;
				position: absolute;/*绝对定位,当前父元素为box*/
				top:100px;
				left:0;
			}
			.box4{
				width:100px;
				height:100px;
				background-color:gold;
				position: absolute;/*绝对定位,当前父元素为box*/
				top:200px;
				left:100px;
			}
           	.box5{
				width:100px;
				height:100px;
				background-color:pink;
				position: absolute;/*绝对定位,当前父元素为box*/
				top:100px;
				left:100px;
			}
			
		</style>
	</head>
	<body>
		<div class="box">
		<div class="box1"></div>
		<div class="box2"></div>
		<div class="box3"></div>
		<div class="box4"></div>
        <div class="box5"></div>
		</div>
		
	</body>
</html>

运行实例 »

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

感悟:绝对定位是根据父元素来确定自身的位置。

Correction status:qualified

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