When using the css attribute filter: blur (), why setting z-index does not solve: the after pseudo-element obscures the main element?

1. Recently, when I styled a form, I wanted the background of the form to be ground glass, so I used filter:blur () to set it.
the code structure is

<body id="index-bg">
  <section id="the-form">
      <div id="container">
          blur
      </div>
  </section>
</body>   

css style is:

-sharpthe-form{
    width: 600px;
    height: 300px;
    display: block;
    position: relative;
    top: 50%;
    left: 50%;
    margin-top: -150px;
    margin-left: -300px;
    border-radius: 10px;
    background: inherit;
    font-family: my-font;
    font-size: 30px;
}
-sharpthe-form > div {
    display: block;
    z-index: 10;
}
-sharpthe-form:after{
    content: "";
    /**/
    width: 100%;
    height: 100%;

    position: absolute;/**/
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 5;
    /**/
    background: inherit;
    -webkit-filter: blur(15px);
       -moz-filter: blur(15px);
            filter: blur(15px);
} 

but no matter how you set z-index , the pseudo element is always above the text within < div id= "container" > :

.

clipboard.png
what"s going on?
there is also a question: the width:100% of pseudo elements doesn"t work, so why does it affect the size of the ground glass (that is, its own size)?
Thank you here!

Mar.18,2021

z-index does not work on elements whose position is static, so you can add {position: relative} to-sharpcontainer.


there are a lot of problems with your code. Without saying much, I'll point out your problem first.

Why is the text always at the bottom of BUG1:
It is important to change

(1)-sharpthe-form:after to-sharpthe-form:before,. : before can be used to insert some content before an element;: after can be used to insert some content after an element;
(2)-sharpthe-form pseudo-class zMui index 5; change it to z term index:-1; let the hair mirror at the bottom.

BUG2: I copied your code because you didn't give the body and section background settings, so I added a css:
myself.
body {
    min-height: 100vh;
    box-sizing: border-box;
    margin: 0;
    padding-top: calc(50vh - 6em);
    font: 150%/1.6 Baskerville, Palatina,serif;
}
body, section::before {
    background: url("assets/images/banner_4.png") 0 / cover fixed;
}

but I found that there was no ground glass effect. I found that you added background: inherit;, to-sharpthe-form and its pseudo classes so that it could not appear, so I deleted it. The effect is as follows:

I don't know the reason why you write like this. Maybe the css style I added is different from yours.

question: the width:100% of pseudo-elements does not work, why can it still affect the size of this ground glass (that is, its own size)?
The width:100% of

pseudo elements works, so it can affect the size of this frosted glass. I don't know why you have this idea.

Menu