首页 > 开发 > CSS > 正文

CSS3制作精致的照片墙特效

2024-07-11 08:25:43
字体:
来源:转载
供稿:网友

本文实例为大家分享利用CSS3动画制作照片墙的详细步骤,供大家参考,具体内容如下

第一种实现效果:

Html代码如下:

XML/HTML Code复制内容到剪贴板
  1. <body>   <h2>照片墙制作</h2>  
  2. <div class="container">   <img class="img1" src="img/img (1).jpg" height="150" width="150" alt="">  
  3. <img class="img2" src="img/img (2).jpg" height="160" width="200" alt="">   <img class="img3" src="img/img (3).jpg" height="170" width="200" alt="">  
  4. <img class="img4" src="img/img (4).jpg" height="240" width="200" alt="">   <img class="img5" src="img/img (5).jpg" height="300" width="300" alt="">  
  5. </div>   </body>  
  6.   

CSS代码如下:

CSS Code复制内容到剪贴板
  1. <style>    * {margin:0; padding:0;}   
  2. body { background-color: #eee; padding-top: 50px;}    h2 { text-align: center;}   
  3. .container { position: relative; width:1000px; height:700px; margin:0px auto; }    img { position: absolute; top:50px; left:100px; cursor: pointer;   
  4. padding:10px 10px 25px; background-color: #fff; border:1px solid #ddd;    transition:0.5s; box-shadow: 3px 3px 3px #ccc;   
  5. }    .img1 { left:40px; top:20px; transform:rotate(30deg); z-index: 1;}   
  6. .img2 { left:156px; top:156px; transform:rotate(-30deg); z-index: 1;}    .img3 { left:381px; top:60px; transform:rotate(30deg); z-index: 1;}   
  7. .img4 { left:458px; top:256px; transform:rotate(30deg); z-index: 1;}    .img5 { left:684px; top:110px; transform:rotate(-40deg); z-index: 1;}   
  8. img:hover { transform:rotate(0deg); transform:scale(1.5); box-shadow: 6px 6px 6px #656565; z-index: 2;}    </style>  
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表