http://www.w2bc.com/Article/5582
What we bring to you today is to use CSS3 technology to achieve the mouse through the picture, showing the animation effect of the picture description. When the mouse passes through the picture, the picture animation shrinks and the gradient displays a description. Let's see it together:
Online preview Source Download
Let's learn the code for this case together.
HTML code:
<div align= "center" > <div class= "carre_couleur Base_hov" style= "" > <a target= "_blank" hre f= "http://www.w2bc.com" > <div class= "Retract" style= "" > </div> <div class= "acced" > <div class= "big_acced" style= "COLOR: #f39c 12; " > Best home</div> <div class= "middle_acced" > This home is the best</div> </div> </a> </div> <div class= "Carre_couleur Base_hov" style= "" > <a target= "_blank" href= "http://www.w2bc.com" > <div class= "Retract" style= "" > </div> <div cl ass= "acced" > <div class= "big_acced" style= "color: #27ae60;" > Best pic</div> <div class= "middle_acced" > This pic is the best</div> </div > </a> </div> <div class= "carre_couleur Base_hov" style= "" > <a target= "_blank" href= "http://www.w2bc.com" > <div class= "Retract" style= "" > < ; img src= "img/3.png" ></div> <div class= "acced" > <div class= "big_acced" style= "COLOR: #c0392b;" > Best pc</div> <div class= "middle_acced" > This computer is the best</div> </div> </a> </div>
<DivAlign= "Center"> <Divclass= "Carre_couleur Base_hov"style=""> <aTarget= "_blank"href= "Http://www.w2bc.com"> <Divclass= "Retract"style= "Background-color: #f8b334;"> <imgsrc= "Img/1.png"></Div> <Divclass= "acced"> <Divclass= "big_acced"style= "color: #f39c12;">Best HOME</Div> <Divclass= "middle_acced">This home was the best</Div> </Div> </a> </Div> <Divclass= "Carre_couleur Base_hov"style= "Background-color: #2ecc71;"> <aTarget= "_blank"href= "Http://www.w2bc.com"> <Divclass= "Retract"style= "Background-color: #2ecc71;"> <imgsrc= "Img/2.png"></Div> <Divclass= "acced"> <Divclass= "big_acced"style= "color: #27ae60;">Best PIC</Div> <Divclass= "middle_acced">This pic was the best</Div> </Div> </a> </Div> <Divclass= "Carre_couleur Base_hov"style= "Background-color: #e74c3c;"> <aTarget= "_blank"href= "Http://www.w2bc.com"> <Divclass= "Retract"style= "Background-color: #e74c3c;"> <imgsrc= "Img/3.png"></Div> <Divclass= "acced"> <Divclass= "big_acced"style= "color: #c0392b;">Best PC</Div> <Divclass= "middle_acced">This computer are the best</Div> </Div> </a> </Div>
CSS3 Code:
. carre_couleur {width:200px; height:200px; Display:inline-block; position:relative; margin-top:0px; }. Base_hov. Retract {-webkit-transition:all 200ms ease-in; -webkit-transform-origin:50% 20%; -webkit-transform:scale (1); -moz-transition:all 200ms ease-in; -moz-transform-origin:50% 20%; -moz-transform:scale (1); -ms-transition:all 200ms ease-in; -ms-transform-origin:50% 20%; -ms-transform:scale (1); Transition:all 200ms ease-in; transform-origin:50% 20%; Transform:scale (1); width:200px; height:200px; Position:absolute; Z-index:2; left:0; }. Base_hov:hover. Retract {-webkit-transition:all 200ms ease-in; -webkit-transform:scale (0.6); -moz-Transition:all 200ms ease-in; -moz-transform:scale (0.6); -ms-transition:all 200ms ease-in; -ms-transform:scale (0.6); Transition:all 200ms ease-in; Transform:scale (0.6); }. acced {width:180px; padding:10px; bottom:0; Position:absolute; Z-index:1; Text-align:left; }. big_acced {color: #ffffff; font-size:25px; font-weight:400; }. middle_acced {color: #ffffff; font-size:15px; font-weight:400; }
. Carre_couleur{width:200px;Height:200px;Display:Inline-block;position:relative;Margin-top:0px; }. Base_hov. Retract{-webkit-transition:All 200ms ease-in;-webkit-transform-origin:50% 20%;-webkit-transform:Scale (1);-moz-transition:All 200ms ease-in;-moz-transform-origin:50% 20%;-moz-transform:Scale (1);-ms-transition:All 200ms ease-in;-ms-transform-origin:50% 20%;-ms-transform:Scale (1);transition:All 200ms ease-in;Transform-origin:50% 20%;Transform:Scale (1);width:200px;Height:200px;position:Absolute;Z-index:2; Left:0; }. Base_hov:hover. Retract{-webkit-transition:All 200ms ease-in;-webkit-transform:Scale (0.6);-moz-transition:All 200ms ease-in;-moz-transform:Scale (0.6);-ms-transition:All 200ms ease-in;-ms-transform:Scale (0.6);transition:All 200ms ease-in;Transform:Scale (0.6); }. acced{width:180px;padding:10px;Bottom:0;position:Absolute;Z-index:1;text-align: Left; }. big_acced{Color:#ffffff;font-size:25px;Font-weight: -; }. middle_acced{Color:#ffffff;font-size:15px;Font-weight: -; }
Copy the above code into your HTML and try the results.
Pure CSS3 Mouse After picture display description effect