Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trigger banner's blur effect while hover on text overlay

I’ve just customizing my blog with a banner photo (the two syringes) that when it’s being hovered, the photo will blurred out and display the link. However, the text container was on top of the photo, causing it not to be blurred. I’m wondering if there are any solutions that will trigger the overlaid photo and show the link at the same time?
(image blurred -> shows link and reverse when not being hovered)
Live preview

CSS

#banner-container {
            display:block;
            position:relative;
         }
         #banner-container img {
            width:375px;
            margin-top:24px;
            margin-bottom:24px;
            position:center;
         }
         #text-container {
             position:absolute;
             margin-top:23px;
             margin-left:62px;
             top:0;
             left:0;
             width:375px;
             height:234px;
             display: flex;
             align-items: center;
             justify-content: center;
             filter: blur(30px);
             transition: all 0.2s ease-out;
         }
         #text-container:hover {
             filter: none;
             transition: all 0.2s ease-in;
         }

HTML

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<div id="banner-container"><img src="https://static.tumblr.com/siia3cb/0frs4664t/diacetyl.png">
                    <div id="text-container">
                    <a href="https://diangeloalvaro.tumblr.com" target="_blank">follow me on tumblr</a>&emsp;
                    <a href="https://sk5p4qqqqqqqqq.tumblr.com" target="_blank">background credit</a>
                </div>
                </div>

>Solution :

You are blurring the whole container and contents… shouldn’t you just blur the image?

#banner-container {
  display: inline-block;
  position: relative;
}

#banner-container img {
  width: 375px;
  display: block;
  filter: blur(0px);
  transition: all 0.2s ease-out;
}

#text-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid red;
}

#banner-container:hover img {
  filter: blur(30px);
  transition: all 0.2s ease-in;
}
<div id="banner-container"><img src="https://static.tumblr.com/siia3cb/0frs4664t/diacetyl.png">
  <div id="text-container">
    <a href="https://diangeloalvaro.tumblr.com" target="_blank">follow me on tumblr</a>&emsp;
    <a href="https://sk5p4qqqqqqqqq.tumblr.com" target="_blank">background credit</a>
  </div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading