1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 背景图片hover加蒙层_css3实现图片遮罩效果鼠标hover以后出现文字

背景图片hover加蒙层_css3实现图片遮罩效果鼠标hover以后出现文字

时间:2020-04-01 01:00:49

相关推荐

背景图片hover加蒙层_css3实现图片遮罩效果鼠标hover以后出现文字

鼠标hover 以后。图片上面出现一个遮罩, 透明度变化, 显示设置好的文字的文字,完全使用css 实现,下图是效果

关键代码

复制代码代码如下:

.featured-image:hover {

opacity: 0.9;

color: #fff;

background: rgba(0,0,0,0.8);

}

看源码吧

复制代码代码如下:

无标题文档

#content article {

float: left;

margin-right: 4%;

max-width: 236px;

position: relative;

width: 22%;

margin-bottom: 3.5%;

}

#content article:nth-child(4n+4) {

margin-right: 0;

}

.post-format-content {

position: relative;

background: #111;

}

.post-thumbnail {

max-width: 100%;

height: auto;

overflow: hidden;

}

.content-wrap {

padding: 0;

position: absolute;

text-align: center;

width: 100%;

top: 0;

bottom: 0;

display: table-cell;

vertical-align: middle;

overflow: hidden;

}

.content-wrap h1.entry-title {

display: table;

font-size: 110%;

height: 100%;

text-transform: uppercase;

width: 100%;

margin:0;

}

.edit-link {

z-index: 2;

}

.featured-image {

display: table-cell;

position: relative;

transition: opacity .25s ease-in-out, background .25s ease-in-out;

-moz-transition: opacity .25s ease-in-out, background .25s ease-in-out;

-webkit-transition: opacity .25s ease-in-out, background .25s ease-in-out;

vertical-align: middle;

z-index: 1;

color: #fff;

text-decoration: none;

opacity: 0;

padding: 10%;

}

.featured-image:hover {

opacity: 0.9;

color: #fff;

background: rgba(0,0,0,0.8);

}

.post-thumbnail img {

display: block;

}

img {

max-width: 100%;

height: auto;

}

Music & Fashion

Music & Fashion

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。