Html+CSS实例:居中五环



	
    	
        居中五环
        
    
    
    
    
    
    	
@charset "utf-8";
/* CSS Document */

*
{
	margin:0;
	padding:0;	
}

.circle1,
.circle2,
.circle3,
.circle4,
.circle5{
		position:absolute;
		width:100px;
		height:100px;
		border:10px solid black;
		border-radius:50%;
	}



/*父级居中,子级也会跟着居中(父级作为一个操作平台) */
.plat{
		position:relative;
		top:50%;
		left:50%;
		margin-left:-190px;
		margin-top:-93px;
		/*border:5px solid black;*/
		height:186px;
		width:380px;s
	}




.circle1{
		border-color:red;
		left:0;
		top:0;
	}
	
.circle2{
		border-color:green;
		left:130px;
		top:0;
		z-index:3;  /*z-index属性设置元素的堆叠顺序,其值越高则在离我们观看者最近*/
	}
	
.circle3{
		border-color:yellow;
		left:260px;
		top:0;
		z-index:4;
	}
	
.circle4{
		border-color:blue;
		left:65px;
		top:70px;
		z-index:5;
	}
	
.circle5{
		border-color:purple;
		left:195px;
		top:70px;
		z-index:6;
	}


你可能感兴趣的:(Html+CSS)