首页 > 资源分享 > 正文
css3鼠标划过图片效果两则

css3鼠标划过图片效果两则
效果一:演示地址
html代码:

<div class="main">
<div class="view view-tenth">
<img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_1.jpg" />
<div class="mask">
<h2>Wonder Girls</h2>
<p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和美国乐坛都取得了不错的成绩...</p>
<a href="#" class="link">查看全文</a>
</div>
</div>
<div class="view view-tenth">
<img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_2.jpg" />
<div class="mask">
<h2>Wonder Girls</h2>
<p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和美国乐坛都取得了不错的成绩...</p>
<a href="#" class="link">查看全文</a>
</div>
</div>
<div class="view view-tenth">
<img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_3.jpg" />
<div class="mask">
<h2>Wonder Girls</h2>
<p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和美国乐坛都取得了不错的成绩...</p>
<a href="#" class="link">查看全文</a>
</div>
</div>
<div class="view view-tenth">
<img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_4.jpg" />
<div class="mask">
<h2>Wonder Girls</h2>
<p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和美国乐坛都取得了不错的成绩...</p>
<a href="#" class="link">查看全文</a>
</div>
</div>
</div>

css代码:

.main *{
padding:0;
margin:0;
font-family:'Source Code Pro', Menlo, Consolas, Monaco, monospace;
box-sizing: content-box;
-webkit-box-sizing: content-box;
}
.main {
position: relative;
width: 680px;
margin: 0 auto;
}
.view {
width: 300px;
margin: 10px;
float: left;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
-webkit-box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
-moz-box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
cursor: default;
}
.view .mask{
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.view img {
display: block;
position: relative;
max-width:100%;
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.8);
margin: 20px 0 0 0;
}
.view p {
font-size: 12px;
position: relative;
color: #fff;
padding: 10px 20px 20px;
text-align: left;
}
.view .link {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
text-transform: uppercase;
-webkit-box-shadow: 0 0 1px #000;
-moz-box-shadow: 0 0 1px #000;
box-shadow: 0 0 1px #000;
font-size: 14px;
}
.view .link: hover {
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}
.view-tenth img {
-webkit-transform: scaleY(1);
-moz-transform: scaleY(1);
-o-transform: scaleY(1);
-ms-transform: scaleY(1);
transform: scaleY(1);
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
}
.view-tenth .mask {
background-color: rgba(249, 179, 255, 0.3);
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
transition: all 0.5s linear;
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
.view-tenth h2 {
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
background: transparent;
margin: 20px 40px 0px 40px;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
color: #333;
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
transition: all 0.5s linear;
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
.view-tenth p {
color: #333;
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
transition: all 0.5s linear;
}
.view-tenth .link {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
transition: all 0.5s linear;
}
.view-tenth:hover img {
-webkit-transform: scale(10);
-moz-transform: scale(10);
-o-transform: scale(10);
-ms-transform: scale(10);
transform: scale(10);
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
.view-tenth:hover .mask {
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}
.view-tenth:hover h2,
.view-tenth:hover p,
.view-tenth:hover .link {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}

css3鼠标划过图片效果两则
效果二:演示地址
html代码:

<div class="main">
<div class="view view-tenth">
 <figure>
 <div class="thumb"><img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_1.jpg" /></div>
 <div class="mask">
 <h2>Wonder Girls</h2>
 <p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和...</p>
 <a href="#" class="link">查看全文</a>
 </div>
 </figure>
 </div>
 <div class="view view-tenth">
 <figure>
 <div class="thumb"><img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_2.jpg" /></div>
 <div class="mask">
 <h2>Wonder Girls</h2>
 <p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和...</p>
 <a href="#" class="link">查看全文</a>
 </div>
 </figure>
 </div>
 <div class="view view-tenth">
 <figure>
 <div class="thumb"><img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_3.jpg" /></div>
 <div class="mask">
 <h2>Wonder Girls</h2>
 <p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和...</p>
 <a href="#" class="link">查看全文</a>
 </div>
 </figure>
 </div>
 <div class="view view-tenth">
 <figure>
 <div class="thumb"><img src="https://www.pastdust.com/wp-content/uploads/2015/10/css3_4.jpg" /></div>
 <div class="mask">
 <h2>Wonder Girls</h2>
 <p>Wonder Girls一向以青春活力的形象展现在观众面前,先后在韩国和...</p>
 <a href="#" class="link">查看全文</a>
 </div>
 </figure>
 </div>
</div>

css代码:

.main *{
	padding:0;
	margin:0;
	font-family:'Source Code Pro', Menlo, Consolas, Monaco, monospace;
	box-sizing: border-box;
	-webkit-box-sizing: border-box;

}
.main {
    position: relative;
    width: 680px;
    margin: 0 auto;
}
.view {
   width: 300px;
   margin: 10px;
   float: left;
   border: 10px solid #fff;
   -webkit-box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
   -moz-box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
   box-shadow: 1px 1px 2px #e6e6e6,-1px -1px 2px #e6e6e6;
   cursor: default;
}
.view figure {
	margin: 0;
	position: relative;
}
.view figure img {
	max-width: 100%;
	display: block;
	position: relative;
}
.view .thumb {
	overflow: hidden;
}
.view .mask {
	position: absolute;
	top: 0;
	left: 0;
	bottom:0;
	padding: 10px;
	background: rgb(233, 194, 236);
	background-color: rgba(233, 194, 236, 0.9);
	color: #ed4e6e;
}

.view .mask h2 {
	margin: 0 0 5px;
	padding: 0 0 5px;
	color: #fff;
	font-size: 18px;
	text-align: center;
	border-bottom:1px solid rgba(255,255,255,.2);
}
.view .mask p{
	font-size: 14px;
}
.view .link {
	position: absolute;
	bottom: 10px;
	right: 10px;
	text-align: center;
	padding: 5px 10px;
	border-radius: 2px;
	display: inline-block;
	background: #ed4e6e;
	color: #fff;
	text-decoration:none;
}


.view-tenth {
	-webkit-perspective: 1700px;
	-moz-perspective: 1700px;
	perspective: 1700px;
	-webkit-perspective-origin: 0 50%;
	-moz-perspective-origin: 0 50%;
	perspective-origin: 0 50%;
}
.view-tenth figure {
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	transform-style: preserve-3d;
}

/*
.view-tenth figure img {
	-webkit-transition: -webkit-transform 0.4s;
	-moz-transition: -moz-transform 0.4s;
	transition: transform 0.4s;
}

.view-tenth figure:hover img{
	-webkit-transform: translateX(25%);
	-moz-transform: translateX(25%);
	-ms-transform: translateX(25%);
	transform: translateX(25%);
}*/

.view-tenth .mask {
	width: 50%;
	opacity: 0;
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility: hidden;
	backface-visibility: hidden;
	-webkit-transform-origin: 0 0;
	-moz-transform-origin: 0 0;
	transform-origin: 0 0;
	-webkit-transform: rotateY(-90deg);
	-moz-transform: rotateY(-90deg);
	transform: rotateY(-90deg);
	-webkit-transition: -webkit-transform 0.4s, opacity 0.1s 0.3s;
	-moz-transition: -moz-transform 0.4s, opacity 0.1s 0.3s;
	transition: transform 0.4s, opacity 0.1s 0.3s;
}
.view-tenth figure:hover .mask{
	opacity: 1;
	-webkit-transform: rotateY(0deg);
	-moz-transform: rotateY(0deg);
	transform: rotateY(0deg);
	-webkit-transition: -webkit-transform 0.4s, opacity 0.1s;
	-moz-transition: -moz-transform 0.4s, opacity 0.1s;
	transition: transform 0.4s, opacity 0.1s;
}

文章评论

共有 1 条评论

  1. 依娜

    支持你加分

Top