在我的代码上,我将浏览器宽度划分为2个div.我计划在每个div上应用一个超链接,比如2个大按钮,但在此之前,我想对它们应用一些webkit-filter,因此它们作为按钮变得更加直观.
如何在这些div上应用超链接并在悬停时应用blur / unblur而不模糊文本?
这是我到目前为止使用的代码:
(仅用于测试目的的图像:P)
#containergaleria {
display: table;
width: 100%;
}
#containergaleria div {
display: table-cell;
width: 50%;
}
#imagens {background-image: url("http://gamerealla.ru/wp-content/uploads/2014/09/1392986721_r1.jpg");
background-position: right center;
}
#videos {background-image: url("http://gamehall.uol.com.br/v10/wp-content/uploads/2015/01/Black-Desert-Online-Beast-Master-Woman-02.jpg");
background-position: left center;
}
p.centertext {
margin-top: 25%;
margin-bottom: 25%
}
body {
overflow:hidden;
}
<div id="containergaleria">
<div id="imagens"><p class="centertext" align="right"><a class="button-medium pull-center" href="https://stackoverflow.com/" target="_blank">IMAGENS</a> </p></div>
<div id="videos"><p align="left"> <a class="button-medium pull-center" href="https://stackoverflow.com/" target="_blank">VÍDEOS</a></p></div>
</div>
最佳答案 你可以通过使用背景:在css上的元素之前完成它.
#imagens:before,
#videos:before {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
content: "";
transition: all .5s ease;
-webkit-transition: all .5s ease;
filter: blur(0);
-webkit-filter: blur(0);
}
#imagens:hover:before,
#videos:hover:before {
filter: blur(2px);
-webkit-filter: blur(2px);
}
#imagens:before {
background-image: url("http://gamerealla.ru/wp-content/uploads/2014/09/1392986721_r1.jpg");
background-position: right center;
}
#videos:before {
background-image: url("http://gamehall.uol.com.br/v10/wp-content/uploads/2015/01/Black-Desert-Online-Beast-Master-Woman-02.jpg");
background-position: left center;
}
检查以下小提琴:
https://jsfiddle.net/k486zf3w/