纯css实现照片墙3D效果_html/css_WEB-ITnose
每张照片都有美丽的故事、美好的回忆。家居中的照片墙则帮你展现出这些承载着家庭重要记忆的照片,除了用画框装饰照片挂在墙上外,照片墙还可以演变为手绘照片墙。也经常在网上看到一些关于照片墙的特效案例,决定自己动手试试。
v直接上代码
这篇博客呢就是演示一个照片墙的效果。所以废话不多说,直接上代码然后展示特效。有兴趣的道友可以自己练练手试试。也可以改动改动其中的属性多玩玩,自己测试的时候建议用美女的照片,绝对"乐在其中"。
1.准备材料:
准备材料就是没什么材料,自己麻溜赶快的去: 百度找几张美女的照片来测试即可。
2.html代码:
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>照片墙</title> <link href="Content/index.css" rel="stylesheet" /></head><body> <div class="container"> <!--美女的照片自己准备,小样的照片百度有 :)--> <img class="img img1 lazy" src="/static/imghw/default1.png" data-src="img/1.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img2 lazy" src="/static/imghw/default1.png" data-src="img/2.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img3 lazy" src="/static/imghw/default1.png" data-src="img/3.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img4 lazy" src="/static/imghw/default1.png" data-src="img/4.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img5 lazy" src="/static/imghw/default1.png" data-src="img/5.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img6 lazy" src="/static/imghw/default1.png" data-src="img/6.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img7 lazy" src="/static/imghw/default1.png" data-src="img/7.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img8 lazy" src="/static/imghw/default1.png" data-src="img/8.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > <img class="img img9 lazy" src="/static/imghw/default1.png" data-src="img/9.jpg" / alt="纯css实现照片墙3D效果_html/css_WEB-ITnose" > </div></body></html>
3.CSS代码:
* { margin:0; padding:0;}body { background-color:#eee;}.container { width:960px; height:450px; margin:60px auto; position:relative;}.img { /*宽度可以根据自己选择的照片内容而定*/ width:150px;}.container img:hover { box-shadow:15px 15px 20px rgba(50,50,50,0.4); transform:rotate3d(1,1,1,180deg) scale(1.50); -webkit-transform:rotate3d(1,1,1,180deg) scale(1.50); -moz-transform:rotate3d(0deg,0deg,0deg) scale(1.50); -ms-transform:rotate3d(0deg,0deg,0deg) scale(1.50); /*本身图片的z-index是1,鼠标经过时候设置成2,那么这张图片就会"上来"*/ z-index:2;}.container img { /*给照片加一个相框的效果*/ padding: 10px 10px 15px; background-color: white; border: 1px solid #ddd; box-shadow: 2px 2px 3px rgba(50,50,50,0.4); /*渐出动画效果*/ -moz-transition: all 0.5s ease-in; -o-transition: all 0.5s ease-in; -webkit-transition: all 0.5s ease-in; transition: all 0.5s ease-in; z-index: 1;}.img1 { left:400px; top:0; /*CSS3属性transform:旋转:rotate,缩放:scale,倾斜:skew */ transform:rotate(-5deg); /*-webkit代表chrome、safari私有属性*/ -webkit-transform:rotate(-5deg); /*-moz代表firefox浏览器私有属性*/ -moz-transform:rotate(-5deg); /*-ms代表IE浏览器私有属性*/ -ms-transform:rotate(-5deg);}.img2 { left:600px; top:0; /*旋转角度可以根据自己的审美观定夺*/ transform:rotate(-20deg); -webkit-transform:rotate(-20deg); -moz-transform:rotate(-20deg); -ms-transform:rotate(-20deg);}.img3 { bottom:0px; right:0; transform:rotate(5deg); -webkit-transform:rotate(5deg); -moz-transform:rotate(5deg); -ms-transform:rotate(5deg);}.img4 { bottom:400px; left:300px; transform:rotate(-10deg); -webkit-transform:rotate(-10deg); -moz-transform:rotate(-10deg); -ms-transform:rotate(-10deg);}.img5 { bottom:0px; top:0; transform:rotate(-10deg); -webkit-transform:rotate(-10deg); -moz-transform:rotate(-10deg); -ms-transform:rotate(-10deg);}.img6 { left:0px; top:0; transform:rotate(10deg); -webkit-transform:rotate(10deg); -moz-transform:rotate(10deg); -ms-transform:rotate(10deg);}.img7 { left:850px; top:0; transform:rotate(20deg); -webkit-transform:rotate(20deg); -moz-transform:rotate(20deg); -ms-transform:rotate(20deg);}.img8 { bottom:-20px; top:650px; transform:rotate(5deg); -webkit-transform:rotate(5deg); -moz-transform:rotate(5deg); -ms-transform:rotate(5deg);}.img9 { left:550px; top:100px; transform:rotate(15deg); -webkit-transform:rotate(15deg); -moz-transform:rotate(15deg); -ms-transform:rotate(15deg);}
css代码的这些注释也是热乎的,大家可以自己看看,可以改动其中的一些属性多玩玩。
4.效果演示:
5.源码下载:
https://github.com/toutouge/WebProject/tree/master/CSS3PhotoWall
v博客总结
其实关于照片墙的效果还可以用css3实现很多酷炫的效果。比如说可以加个定时器的效果,让图片像转动的魔方一样。那估计更炫酷。有兴趣可以自己动手试一试。当然,关于那些酷炫的效果网上一搜一大把,不过若真想感受一下css3的魅力,还是得自己动手捣鼓捣鼓。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.
