The puzzling issue with CSS mask's maximum height

I've encountered an issue with using a css mask to hide a position: fixed; item because overflow: hidden; does not seem to work as expected. Everything functions perfectly in all browsers until the height of the div containing the mask reaches a certain height, like 1280px on iPad or 2000px on desktop Safari.

I haven't been able to find any information or documentation on this specific problem and I'm really stuck. Has anyone else experienced issues with css masks that might provide some insight into why this is happening?

For reference, here's a screencast demonstrating the bug and the code used to replicate it:

Additionally, you can access the code used in the demo by downloading this zip file:

If anyone has any ideas or potential solutions to this issue, I would greatly appreciate the help!

--- HTML ---

<div class="attn hairline"></div>

<div class="shadow"></div>

<div id="home">
    <div class="attn blur"></div>

    <div id="content">
        <p>Hey, here is some awesome content, stuff you will definitely want to read.</p>
    </div>
</div>

--- CSS ---

* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
width: 100%;
text-align: center;
background-color: #f0f0f0;
}

.attn {
position: fixed;
width: 80%;
height: 100%;
left: 50%;
margin-left: -40%;
background: no-repeat center;
background-size: 100% auto;
}
.hairline {
background-image: url(../img/attn.svg); 
}
.blur {
background-image: url(../img/blur.png);
}
.shadow {
position: relative;
height: 20px;
margin-bottom: -20px;
box-shadow: 0px -3px 6px rgba(0,0,0,.1);
top: 100%;
}

#home {
position: relative;
top: 100%;
background: #fff;
mask:         url(../img/mask.svg);
-webkit-mask: url(../img/mask.svg);
-o-mask:      url(../img/mask.svg);
-ms-mask:     url(../img/mask.svg);

/* 1281px will kill the mask on iPad, 2001px will kill it on the desktop */
height: 1280px;
}
#content {
padding: 10% 5%;
}

Answer №1

I found a solution by adding a max-height attribute to the masked element until it reached the top of the browser window. Since the fuzzy image text was disappearing at that point, I took that opportunity to remove the max-height attribute once the image was gone. It worked perfectly, although I still hope to address the root issue in the future. It seems like a browser quirk since it was consistently behaving in such a random manner.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the reason my anchor link padding is not functioning properly?

I have an anchor link in the footer that, when clicked, scrolls to an anchor in the middle of the page. The issue I'm facing is that despite adding padding to the anchor, it still aligns with the top of the browser without any grip from the padding. W ...

Is it possible to include a class in a 'label' element?

Forgive me if this is a simple question, but I'm curious - is it possible to add a class directly to a 'label' tag without needing to enclose it in a 'span' tag for styling? As I delve into "CSS: The Missing Manual," the book instr ...

Generate and save (html/css/js) files directly on the client's browser

Recently, I created a code playground using React similar to liveweave. Users can save their "code playgrounds" and access them later by utilizing Firebase for the database. These "code playgrounds" consist of HTML, CSS, and JavaScript elements. My goal no ...

The issue of misaligned checkboxes when selected - HTML/CSS

Currently, the alignment of checkboxes is disrupted when they are checked. The unchecked checkboxes align in a straight line, but once checked, the boxes shift towards the left. I would like the alignment to remain consistent and in a straight line regardl ...

Looking to alter the CSS of an ID element when hovering over a link on your website?

Irrespective of the positioning of the links in the html, a simple hover effect can trigger changes like switching images or altering backgrounds anywhere on the website. The ideal solution would involve a straightforward method without the need for Javas ...

What is causing this error to appear in Next.js? The <link rel=preload> is showing an invalid value for `imagesrcset`

I've got a carousel displaying images: <Image src={`http://ticket-t01.s3.eu-central-1.amazonaws.com/${props[organizationId].events[programId].imgId}_0.cover.jpg`} className={styles.carouselImage} layout="responsive" width={865} ...

Effect of Active or Focus on the HTML <ul> element

Check out this example of a UL tag: <ul style="list-style-type:none; padding:5px ; border:solid 1px #666666;"> <li>I am waiting </li> <li>I am waiting </li> <li>I am waiting </li> <li>I am wa ...

What is the best way to align the navigation with a maximum of three elements (lists) in a row using responsive design?

I've been trying various methods but haven't been able to center it while keeping the padding intact. It's a mobile navigation bar. Here is what my code is producing currently: [1]: https://i.sstatic.net/sHEjj.png This is how I want it to ...

Position the icon in the center using :before pseudo-element

I've been trying to center an icon both horizontally and vertically inside a link using :before, but so far I haven't been successful. Despite my numerous attempts, I can't figure out why the icon won't center. Here's my HTML: & ...

Modifying the appearance of scoped child components in Vue: A step-by-step guide

I am currently using vant ui components in my Vue project, such as buttons. I would like to make some minor style adjustments, like changing the color and border, but I am unsure how to do it. Can anybody please assist me in solving this issue? Thank you i ...

Is the Galaxy Tab experiencing device debugging issues?

Has anyone successfully enabled on-device debugging with the Galaxy Tab? I have a Stock Generic Galaxy Tab and I'm able to "Run" my apps on the device using Eclpise, but when I try to "Debug" it doesn't connect to the debugger. Any suggestions? ...

Addressing padding inconsistencies in mobile email HTML templates

I am new to the world of HTML and CSS. I apologize if this question seems trivial, as I have searched extensively online with no success! You can access my email HTML template here. The issue I am facing is: The top and bottom padding around the backgrou ...

Is there a way to utilize the reset() function within an input form?

Is there a way to automatically reset the textbox when submitting a value? Below is my code: <!DOCTYPE html> <html> <body> <ul id="myList"> </ul> <input type="text" id="myText" value="&q ...

Receiving a sleek black overlay with dynamic text upon hovering over an image

I have been searching extensively for a solution to my issue, but I haven't been able to make it work in my application. What I want is to create a black overlay over an image when it is hovered over, with text that resembles a button appearing on top ...

Two div elements refusing to be positioned side by side

I'm struggling to position two div elements next to each other, with a third one to be added later. I've experimented with floating, display, and positioning options, but nothing seems to work. I've even copied code from other websites, but ...

Ways to prevent background replacement in CSS

Recently I came across this snippet of code: .active { background-color: black; color: white; } span { margin: 10px; } a { text-decoration: none; } .center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .tabButton { margi ...

The content within the iframe lacks styling

Currently, I am facing an issue with displaying an HTML page on another page using an iframe. Both pages are on the same site during development. Despite successfully linking the page with the iframe, it seems that the styles are not being displayed with ...

Troubleshooting Issue: Google Map not resizing correctly when window size changes

Utilizing media queries, I have implemented an adaptive layout on my website. However, when I adjust the size of the browser window beyond a specific media query, the google map begins to malfunction (refer to the image) My Solution: CSS: #googleMap2{d ...

Placing two parent flex containers on top of each other

I'm in a situation where I have two .container elements, both set at a height of 50%. Within these containers are the child divs .element, which belong to their respective parent divs .container. The problem arises when applying media queries with f ...

Menu with option to delete next to each selection item

My task is to create a drop-down menu with a delete 'X' option next to each item. This functionality should work even when the drop-down is dynamically populated, without resorting to using a list as an alternative. UPDATE: The icons next to eac ...