简体   繁体   English

CSS悬停图像和显示图标不显示

[英]css hover image and show icon not show

I design book front using css and need to show search icon in hover image using css like this : 我使用CSS设计书前,需要像这样使用css在悬停图像中显示搜索图标:

.third-effect .mask {
    opacity: 0;
    overflow:visible;
    border:100px solid rgba(0, 0, 0, 0.7);
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    -ms-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}
.third-effect a.info {
    position:relative;
    top:-10px;
    opacity: 0;
    -webkit-transition: opacity 0.5s 0s ease-in-out;
    -moz-transition: opacity 0.5s 0s ease-in-out;
    -o-transition: opacity 0.5s 0s ease-in-out;
    -ms-transition: opacity 0.5s 0s ease-in-out;
    transition: opacity 0.5s 0s ease-in-out;
}
.third-effect:hover .mask {
    opacity: 1;
    border:100px solid rgba(0, 0, 0, 0.7);
}
.third-effect:hover a.info {
    opacity:1;
    -moz-transition-delay: 0.3s;
    -webkit-transition-delay: 0.3s;
    -o-transition-delay: 0.3s;
    -ms-transition-delay: 0.3s;
    transition-delay: 0.3s;
}
.view {
    overflow: hidden;
    position: relative;
    text-align: center;
    cursor: default;
    width: 122px;
    height: 160px;
    box-shadow: -3px 3px 0 #ccc, -6px 6px 0 #999, -9px 9px 0 #ccc;
    -webkit-transition: all 0.15s ease;
}
.view:hover {
    box-shadow: -5px 5px 0 #ccc, -10px 10px 0 #999, -15px 15px 0 #ccc;
}
.view .mask, .view .content {
    width: 122px;
    height: 160px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
}
.view img {
    display: block;
    position: relative;
}
.view a.info {
    background:url("https://cdn3.iconfinder.com/data/icons/mixed-ui-icons-3/93/Untitled-124-128.png") center no-repeat;
    display: inline-block;
    text-decoration: none;
    padding:0;
    text-indent:-9999px;
    width:20px;
    height:20px;
}

But in action my search icon not show in hover image. 但实际上,我的搜索图标未显示在悬停图像中。 how do fix this ?! 如何解决这个问题?

DEMO : http://jsfiddle.net/Sambora/o6nwamag/ 演示: http : //jsfiddle.net/Sambora/o6nwamag/

Try this style it's work. 尝试这种风格是可行的。 in your style remove border and set using background color. 以您的样式删除边框并使用背景色进行设置。

 .third-effect .mask { opacity: 0; overflow:visible; background-color: rgba(0, 0, 0, 0.7); -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; -ms-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } .third-effect a.info { position:relative; top:40px; opacity: 0; -webkit-transition: opacity 0.5s 0s ease-in-out; -moz-transition: opacity 0.5s 0s ease-in-out; -o-transition: opacity 0.5s 0s ease-in-out; -ms-transition: opacity 0.5s 0s ease-in-out; transition: opacity 0.5s 0s ease-in-out; } .third-effect:hover .mask { opacity: 1; } .third-effect:hover a.info { opacity:1; -moz-transition-delay: 0.3s; -webkit-transition-delay: 0.3s; -o-transition-delay: 0.3s; -ms-transition-delay: 0.3s; transition-delay: 0.3s; } .view { overflow: hidden; position: relative; text-align: center; cursor: default; width: 122px; height: 160px; box-shadow: -3px 3px 0 #ccc, -6px 6px 0 #999, -9px 9px 0 #ccc; -webkit-transition: all 0.15s ease; } .view:hover { box-shadow: -5px 5px 0 #ccc, -10px 10px 0 #999, -15px 15px 0 #ccc; } .view .mask, .view .content { height: 160px; left: 0; overflow: hidden; position: absolute; top: 0; width: 122px; } .view img { display: block; position: relative; } .view a.info { background: rgba(0, 0, 0, 0) url("https://cdn3.iconfinder.com/data/icons/mixed-ui-icons-3/93/Untitled-124-128.png") no-repeat scroll center center / 100% auto; display: inline-block; height: 20px; padding: 20px; text-decoration: none; text-indent: -9999px; width: 20px; } 
 <div class="view third-effect"> <img src="http://i.imgur.com/nbynS1m.jpg" /> <div class="mask"> <a href="#" class="info" title="Full Image">Full Image</a> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM