使用CSS3变形和过渡实现的不同的悬浮效果: 缩放和3D变形效果实现
/* 相关CSS */
.grid{
text-align:center;
}
.grid li{
width: 320px;
height: 320px;
display: inline-block;
}
.item{
width: 100%;
height: 100%;
border-radius: 50%;
-webkit-box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.img-a{
background-image:url(http://www.gbtags.com/gb/laitu/320x320&text=GBTAGS/333333/efb73e);
}
.info{
background: rgba(250,84,46, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
}
.info-3d{
background: rgba(250,84,46, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-moz-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-o-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-ms-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
}
.img-b{
background-image:url(http://www.gbtags.com/gb/laitu/320x320&text=GEEKS/333333/efb73e);
}
/* 美化一下文字 */
.info h3{
color: #fff;
font-size: 32px;
margin: 0 50px;
padding: 65px 0 0 0;
font-family: 'microsoft yahei';
font-weight:normal;
}
.info-3d h3{
color: #fff;
font-size: 32px;
margin: 0 50px;
padding: 65px 0 0 0;
font-family: 'microsoft yahei';
font-weight:normal;
}
.item:hover{
-webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
}
.item:hover .info{
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.item:hover .info-3d{
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
opacity: 1;
}
了解如何编写及其相关的注释,请访问:http://www.gbtags.com/gb/rtreplayerpreview/151.htm
/* 相关CSS */
.grid{
text-align:center;
}
.grid li{
width: 320px;
height: 320px;
display: inline-block;
}
.item{
width: 100%;
height: 100%;
border-radius: 50%;
-webkit-box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 0 0 25px rgba(200,200,200,0.6),
0 1px 2px rgba(0,0,0,0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.img-a{
background-image:url(http://www.gbtags.com/gb/laitu/320x320&text=GBTAGS/333333/efb73e);
}
.info{
background: rgba(250,84,46, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
}
.info-3d{
background: rgba(250,84,46, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-moz-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-o-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
-ms-transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
transform: translate3d(0,280px,0) rotate3d(1,0,0,-90deg);
}
.img-b{
background-image:url(http://www.gbtags.com/gb/laitu/320x320&text=GEEKS/333333/efb73e);
}
/* 美化一下文字 */
.info h3{
color: #fff;
font-size: 32px;
margin: 0 50px;
padding: 65px 0 0 0;
font-family: 'microsoft yahei';
font-weight:normal;
}
.info-3d h3{
color: #fff;
font-size: 32px;
margin: 0 50px;
padding: 65px 0 0 0;
font-family: 'microsoft yahei';
font-weight:normal;
}
.item:hover{
-webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.5);
}
.item:hover .info{
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.item:hover .info-3d{
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
opacity: 1;
}
了解如何编写及其相关的注释,请访问:http://www.gbtags.com/gb/rtreplayerpreview/151.htm