Preliminary
- DIV+CSS Foundation
- CSS3 's Transform and transition description
- Mainly used for the rotate/scale of transform
- Several parameters of the animation transition (transition-property/transition-duration/transition-timing-function)
- CSS3 's Box-shadow. It only uses the outer shadow.
Worth mentioning: Many other attributes of the parameters to query the CSS manual, where the display is only used;
Material acquisition
Baidu self-search image material, replace the following code image path can be.
The picture in the sample is greater than 400 pixels and less than 600 pixels, of which 480x270 is mostly
Effect descriptive narration
Initialize the messy picture sort (CSS control), the mouse hover will let the picture in the top level display, and the picture restores the level display + enlarges 1.5 times times
Code implementation
The code contains the gaze
Index.html
<! DOCTYPE html><html lang="zh"><head> <meta charset="UTF-8"> <title>CSS3 Realization of Photo wall</title> <link rel="stylesheet" href="Css/style.css"> </head><body> <H1>Pure CSS3 realization Photo Wall</H1> <div id="container"> <img class="Position_pic1" src="img/1.jpg" alt ="This is a picture of a Meimei"> <img class="Position_pic2" src="img/2.jpg " Alt="This is a picture of Meimei"> <img class="position_pic3" src="img/3.jpg" alt=" This is a Meimei picture "> <img class="position_pic4" src="img/4.jpg" alt ="This is a picture of a Meimei"> <img class="position_pic5" src="img/5.jpg" alt=" This is a Meimei picture "> <img class="position_pic6" src="img/6.jpg" alt ="This is a picture of a Meimei"> <img class="Position_pic7" src="img/7.jpg" alt=" This is a Meimei picture "> <img class="Position_pic8" src="img/8.jpg" alt ="This is a picture of a Meimei"> </div></body></html>
Style.css
*{ margin: 0; padding: 0; Border: 0; outline: 0; }/ * Simplified version reset*/H1{ text-align: center;} / * Text centered * /#container{ position: relative; width: px; margin: 0 auto; }/ * Block Center * /#container img{ position: Absolute ; z-index: 1 ; -webkit-transition-timing-function: ease ; transition-timing-function: ease ; -webkit-transition-duration: 1s ; transition-duration: 1s ; -webkit-transition-property: All; transition-property: All; Border: 5px solid #eee ; box-shadow: 2px 2px 2px rgba (0, 0, 0,. 5) ;}/* Add a small Shadow (outer shadow) and a border to the picture. Here the transition are divided to write, convenient for small partners to understand. Of course, can also be abbreviated: Eg:tansition:all 0.5 ease-out position The function here is to offset the image position, and later can see why Z-index is for the picture stack emissions, here for 1,hover there is 2 (the effect is the bottom picture first display) */#container img: Hover{ z-index: ; -webkit-transform: Rotate (0deg) ; -webkit-transform: Scale (1.5) ; -ms-transform: Rotate (0deg) ; -ms-transform: Scale (1.5) ; transform: Rotate (0deg) ; Transform: Scale (1.5) ; Border: 5px solid #eee ; Box-shadow: ten px px , Rgba (0, 0 , 0,. 5) ;}/* This piece is to let the picture under the Hvoer the graphic transformation, the level display and enlarges 1.5 times times; Transform can also be abbreviated: eg:transform:rotate (90DEG) scale (1); *//* These subclasses are all to locate the initial position and rotation angle of the image */. Position_pic1{top : 100 px ; left : 5 px ; -webkit-transform : rotate (5 deg) ; -ms-transform : rotate (5 deg) ; transform : rotate (5 deg) ; .position_pic2 {top : 200 px ; left : px ; -webkit-transform : rotate (-12 deg) ; -ms-transform : rotate (-12 deg) ; transform : rotate (-12 deg) ; .position_pic3 {top : 20 px ; left : px ; -webkit-transform : rotate (-10 deg) ; -ms-transform : rotate (-10 deg) ; transform : rotate (-10 deg) ; .position_pic4 {top : 400 px ; left : 0 ; -webkit-transform : rotate (45 deg) ; -ms-transform : rotate (45 deg) ; transform : rotate (45 deg) ; .position_pic5 {top : 400 px ; left : px ; -webkit-transform : rotate (-5 deg) ; -ms-transform : rotate (-5 deg) ; transform : rotate (-5 deg) ; .position_pic6 {top : 500 px ; right : px ; -webkit-transform : rotate (-30 deg) ; -ms-transform : rotate (-30 deg) ; transform : rotate (-30 deg) ; .position_pic7 {top : 600 px ; left : px ; -webkit-transform : rotate (5 deg) ; -ms-transform : rotate (5 deg) ; transform : rotate (5 deg) ; .position_pic8 { top: px; Right : px; -webkit-transform: rotate (deg); -ms-transform: rotate (deg); transform: rotate (deg); }
Other
- CSS prefix is complete with the plugin "autoprefix" solution;
- CSS layout is to use the plugin "CSS comb" solution;
- Test browser Firefox 38/chrome 42
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
The pure CSS3 realizes the picture wall