一些css3小案例

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style type="text/css">
	body{height: 1000px;}
		#dv{
			width: 300px;
			height: 300px;
			
			margin: 100px auto;
			position: relative;
			perspective: 1000px;
		}
		#dv::after,#dv::before{
			content: "";
			height: 100%;
			width: 100%;
			border-radius: 150px;
			display: block;
            position: absolute;
            left: 0;
            top: 0;
		}
		#dv::before{
			background-image: url(C:/Users/admin/Desktop/img/1.jpg);
		}
		#dv::after{
			background-image: url(C:/Users/admin/Desktop/img/5.jpg);
			transition:all 2s;
			transform-origin: center bottom ;
		}
		#dv:hover::after{
			transform: rotateX(-180deg);
		}


	</style>
</head>
<body>
<div id="dv"></div>

</body>
</html>

//音乐盒

<!DOCTYPE html>
<html>
<head>
	<title></title>
<style type="text/css">
body{
	margin: 0;
	padding:0;
	background-color: pink;
}
	#dv{
		height: 200px;
		width: 200px;
		margin: 50px auto;
		position: relative;
		transform-style:preserve-3d;
		transition:all 2s;
		
	}
	#dv::before,#dv::after{
		content: "";
		height: 100%;
		width: 100%;
		border-radius: 100px;
        position: absolute;
	}
	#dv::before{
		background-image: url(C:/Users/admin/Desktop/img/zi2.jpg);
        transform: translateZ(0);
        transform: rotateY(180deg);
	}
    #dv::after{
		background-image: url(C:/Users/admin/Desktop/img/zi1.jpg);
		transform: translateZ(0);
	}
	#dv:hover{
		transform: rotateY(180deg);
	}
</style>
</head>
<body>
<div id="dv"></div>
</body>
</html>
//零钱包
<!DOCTYPE html>
<html>
<head>
	<title></title>
<style type="text/css">
	body{
		margin: 0;
		padding:0;
	}
	#nav{
		height: 40px;
        list-style: none;
        
	}
	#nav li{
		float: left;
		height: 100%;
		width: 120px;
		position: relative;
		transition: all 1s;
		transform-style: preserve-3d;
	}
	#nav li span{
		width: 100%;
		height: 100%;
		text-align: center;
		position: absolute;
		line-height: 40px;
        left: 0;
        top: 0;
	}
	#nav li span:first-child{
		background-color: green;
        transform:rotateX(90deg) translateZ(20px);/*注意字的正反 转动了坐标轴跟着动*/
        
	}
	#nav li span:last-child{
		background-color: yellow;
		transform: translateZ(20px);
	}	

    #nav li:hover{
    	transform: rotateX(-90deg);
    }
</style>
</head>
<body>
<ul id="nav">
	<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
</ul>
</body>
</html>

//3D导航

<!DOCTYPE html>
<html>
<head>
	<title></title>
<style type="text/css">
	body{
		margin: 0;
		padding:0;
	}
	#nav{
		height: 40px;
        list-style: none;
        
	}
	#nav li{
		float: left;
		height: 100%;
		width: 120px;
		position: relative;
		transition: all 1s;
		transform-style: preserve-3d;
	}
	#nav li span{
		width: 100%;
		height: 100%;
		text-align: center;
		position: absolute;
		line-height: 40px;
        left: 0;
        top: 0;
	}
	#nav li span:first-child{
		background-color: green;
        transform:rotateX(90deg) translateZ(20px);/*注意字的正反 转动了坐标轴跟着动*/
        
	}
	#nav li span:last-child{
		background-color: yellow;
		transform: translateZ(20px);
	}	

    #nav:hover li{
    	transform: rotateX(-90deg);
    }
    #nav li:nth-child(1)
    {transition-delay: 0s;} /*延时*/
    #nav li:nth-child(2)
    {transition-delay: 0.25s;} /*这里li前面不设置#nav 就会一起转动*/
    #nav li:nth-child(3)
    {transition-delay: 0.5s;}
    #nav li:nth-child(4)
    {transition-delay: 0.75s;}
    #nav li:nth-child(5)
    {transition-delay: 1s;}

</style>
</head>
<body>
<ul id="nav">
	<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
		<li>
		<span>12部分</span>
		<span>34部分</span>
	</li>
</ul>
</body>
</html>
//3D导航改进
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值