Blur / Blur 2 different hover backgrounds

In my code, I divided the width of the browser into 2 divs. I planned to use a hyperlink for each div, for example, two large buttons, but before doing this, I wanted to apply some kind of webkit filter to them to make them more intuitive as a button.

How can I apply a hyperlink to these divs and apply blur / blur on hover without blurring the text?

Here are the codes that I still use: (images are for test purposes only: 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="http://stackoverflow.com/" target="_blank">IMAGENS</a>&nbsp;&nbsp;</p></div>
  
    <div id="videos"><p align="left">&nbsp;&nbsp;<a class="button-medium pull-center" href="http://stackoverflow.com/" target="_blank">VÍDEOS</a></p></div>
  
</div>
Run code
+4
source share
2 answers

you can do this using the background: in front of the element in 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/

+1

. , <img/>. , <img/> z-index ed , .

0

Source: https://habr.com/ru/post/1624888/


All Articles