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

In scale, the bottom blurred element overlaps the scaled element

Goal: The scaled element is not overlapped by the bottom element.

Problem: With a css transition, I scale up an element. In the parent element, the content above and below the child element is blurred. But unfortunately the lower blur effect overlaps the forgotten container.

Question What do I have to do so that the blur effect does not overlay the scaled container?

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

Note: z-index had no effect on me.

My stack Linux / Firefox

My code

.container>*:not(.box) {
  background: black;  
  filter: blur(8px);  
  transition: filter 1s, background 1s;  
  filter: blur(8px); 
}
.box {
  padding: 40px 1px;
  margin: 0 auto;
  width: 500px;
  background: gray; 
  text-align:center;
  transition: scale 1s, background 1s, filter 1s;   
}
.box:focus-within {
  transition: scale 1s, background 1s; 
  scale: 1.8;
  background: lightblue;  
}
<div class="container">
  <p>some text againsome text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again</p>
  <div class="box">
    <div>
      <input >
      <input >
    </div>
  </div>
  <p>some text againsome text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again</p>
  <input >
</div>

>Solution :

Add position: relative (to create a new stacking context) along with a z-index (which you can educate yourself on here):

.container>*:not(.box) {
  background: black;  
  filter: blur(8px);  
  transition: filter 1s, background 1s;  
  filter: blur(8px); 
}
.box {
  padding: 40px 1px;
  margin: 0 auto;
  width: 500px;
  background: gray; 
  text-align:center;
  transition: scale 1s, background 1s, filter 1s;
  position: relative;
  z-index: 1;
}
.box:focus-within {
  transition: scale 1s, background 1s; 
  scale: 1.8;
  background: lightblue;  
}
<div class="container">
  <p>some text againsome text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again</p>
  <div class="box">
    <div>
      <input >
      <input >
    </div>
  </div>
  <p>some text againsome text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again some text again</p>
  <input >
</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