zoukankan      html  css  js  c++  java
  • CSS3系列之3D制作 再研究

    水平翻转效果:

    <!DOCTYPE html>
    <html>
    
    	<head>
    		<meta charset="UTF-8">
    		<title></title>
    		<style type="text/css">
    			.stage {
    				 140px;
    				height: 200px;
    				perspective: 800px;
    			}
    			
    			.container {
    				position: relative;
    				 140px;
    				height: 200px;
    				transform-style: preserve-3d;
    				transition: 1s;
    			}
    			
    			.front {
    				position: absolute;
    				 140px;
    				height: 200px;
            		background-image: url(img/3tb_160824110159262h572240.jpg);
    				background-size: cover;
    				backface-visibility: hidden;
    			}
    			
    			.back {
    				position: absolute;
    				 140px;
    				height: 200px;
    				background-image: url(img/3tb_160824110159xh65572240.jpg);
    				background-size: cover;
    				transform: rotateY(180deg);
    				backface-visibility: hidden;
    			}
    			
    			.stage:hover .container {
    				transform: rotateY(180deg);
    			}
    		</style>
    	</head>
    
    	<body>
    		<div class='stage'>
    			<div class='container'>
    				<div class='front'></div>
    				<div class='back'></div>
    			</div>
    		</div>
    	 
    	 
    	</body>
    </html>
    

     3D 旋转:

    <!doctype html>
    <html lang="en">
    
    	<head>
    		<meta charset="UTF-8" />
    		<title>Document</title>
    		<style type="text/css">
    			* {
    				margin: 0;
    				padding: 0;
    			}
    			
    			.wrap {
    				padding: 50px;
    			}
    			
    			.stage {
    				 100px;
    				height: 100px;
    				-webkit-perspective: 2000px;
    				perspective: 2000px;
    				list-style: none;
    			}
    			
    			.container {
    				position: relative;
    				 100px;
    				height: 100px;
    				-webkit-transform-style: preserve-3d;
    				transform-style: preserve-3d;
    				-webkit-transition: 1s;
    				transition: 1s;
    			}
    			
    			.front {
    				position: absolute;
    				 100px;
    				height: 100px;
    				-webkit-transform: translateZ(50px);
    				transform: translateZ(50px);
    				-webkit-backface-visibility: hidden;
    				backface-visibility: hidden;
    			}
    			
    			.front img {
    				 100%;
    				height: 100%;
    			}
    			
    			.back {
    				position: absolute;
    				display: block;
    				 100px;
    				height: 100px;
    				text-align: center;
    				line-height: 100px;
    				-webkit-transform: rotateY(90deg) translateZ(50px);
    				transform: rotateY(90deg) translateZ(50px);
    				-webkit-backface-visibility: hidden;
    				backface-visibility: hidden;
    			}
    			
    			li:nth-child(1) .back {
    				background-color: skyblue;
    			}
    			
    			li:nth-child(2) .back {
    				background-color: pink;
    			}
    			
    			li:nth-child(3) .back {
    				background-color: lightyellow;
    			}
    			
    			.container:hover {
    				-webkit-transform: rotateY(-90deg);
    				transform: rotateY(-90deg);
    			}
    		</style>
    	</head>
    
    	<body>
    		<ul class="wrap">
    			<li class="stage">
    				<div class='container'>
    					<div class="front"><img src="http://d3.freep.cn/3tb_160824132644ihf4572240.jpg" /></div>
    					<p class="back">帅气的胡歌</p>
    				</div>
    			</li>
    			<li class="stage">
    				<div class='container'>
    					<div class="front"><img src="http://d2.freep.cn/3tb_160824132644w0r4572240.jpg" /></div>
    					<p class="back">美腻的赵丽颖</p>
    				</div>
    			</li>
    			<li class="stage">
    				<div class='container'>
    					<div class="front"><img src="http://d3.freep.cn/3tb_160824235542tkj9572240.jpg" /></div>
    					<p class="back">清纯的刘亦菲</p>
    				</div>
    			</li>
    		</ul>
    	</body>
    
    </html>
    

      

  • 相关阅读:
    cJSON库源码分析
    cJSON 使用详解
    day23
    day22
    作业21
    day21
    作业20
    day20
    作业
    day19
  • 原文地址:https://www.cnblogs.com/libin-1/p/5813050.html
Copyright © 2011-2022 走看看