I've got a page that works fine until the filters get activated. There's a footer
at the end of the body
element which is set up to be fixed
at the bottom of the viewport. Now I needed to create another footer
element with the same positioning. It contains buttons for a form
, and in order for the submit buttons to work, they have to be within the form
element.
When a modal opens on the page (here's the code that does that), the background is dimmed and filtered. But as soon as that filter is in effect, the second footer
is no longer at the bottom of the viewport but rather at the bottom of the other page content, which can be anywhere.
Here's the sample that shows the issue. Just comment out the filter style to see how it should look like. The diverse colours and heights are only set for illustration purposes. I my app, all footers look the same. In fact I'm not using footer2 anymore but need footer1 to be where footer2 is, always.
body>* {
filter: blur(1px);
}
main {
border: 2px solid #64e315;
}
footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
}
#footer1 {
background: #dce2f8;
}
#footer2 {
border: 2px solid #e38e15;
text-align: center;
}
<main>
<p>
Main content
</p>
<p style="height: 150px;">
<!-- Placeholder for fixed footer 1 -->
</p>
<footer id="footer1">
Footer 1<br>Footer 1<br> Footer 1<br>Footer 1
</footer>
</main>
<footer id="footer2">
Footer 2
</footer>
From what I've read now I have the impression that the CSS spec requires this to be. I just cannot understand why. Why should a filter affect any layout? And is there a way I can prevent this? Remember, the buttons need to be in the form or they won't work.