Is there a way to navigate a webpage while using an overlay in Firefox?

When using Chrome and Safari, I can easily scroll through the content with an overlay created using the ::after pseudo class.

However, in Firefox, this functionality doesn't work as expected.

I attempted to adjust the z-index, but that caused the gradient to be hidden.

Changing the top: 80% property did not have the desired effect, as 20% of the height still remained unscrollable.

Is there a better solution for this issue?

HTML

<section>
    <div>
        <p>
            Etiam quis quam. Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo.
            Integer vulputate sem a nibh rutrum consequat. Aliquam erat volutpat. Etiam commodo dui eget wisi. Maecenas libero. Duis risus.
            In sem justo, commodo ut, suscipit at, pharetra vitae, orci.Etiam quis quam. Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo.
            Integer vulputate sem a nibh rutrum consequat. Aliquam erat volutpat. Etiam commodo dui eget wisi. Maecenas libero. Duis risus. In sem justo, commodo ut, suscipit at, pharetra vitae, orci.Etiam quis quam.
            Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo. Integer vulputate sem a nibh rutrum consequat. Aliquam erat volutpat. Etiam commodo dui eget wisi. Maecenas libero. Duis risus.
            In sem justo, commodo ut, suscipit at, pharetra vitae, orci.Etiam quis quam. Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo. Integer vulputate sem a nibh rutrum consequat.
            Aliquam erat volutpat. Etiam commodo dui eget wisi. Maecenas libero. Duis risus. In sem justo, commodo ut, suscipit at, pharetra vitae, orci.Etiam quis quam. Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam,
            tempor suscipit diam nulla vel leo. Integer vulputate sem a nibh rutrum consequat. Aliquam erat volutpat. Etiam commodo dui eget wisi. Maecenas libero. Duis risus. In sem justo, commodo ut, suscipit at, pharetra vitae, orci.Etiam quis quam.
            Nulla accumsan, elit sit amet varius semper, nulla mauris mollis quam, tempor suscipit diam nulla vel leo. Integer vulputate sem a nibh rutrum consequat. Aliquam erat volutpat. Etiam commodo dui eget wisi.it diam nulla vel leo. Integer
            vulputate sem a nibh rutrum consequat. Aliq
        </p>
    </div>
</section>

SCSS

body {
background: black;
section {
    position: relative;
    div {
        height: 500px;
        width: 500px;
        overflow-y: scroll;
        p {
            color: white;
        }
        &:after {
            content: " ";
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            background: -moz-linear-gradient(
                top,
                rgba(137, 255, 241, 0) 0%,
                rgba(0, 0, 0, 1) 100%
            );
            /* FF3.6+ */
            background: -webkit-gradient(
                linear,
                left top,
                left bottom,
                color-stop(0%, rgba(137, 255, 241, 0)),
                color-stop(100%, rgba(0, 0, 0, 1))
            );
            /* Chrome,Safari4+ */
            background: -webkit-linear-gradient(
                top,
                rgba(137, 255, 241, 0) 0%,
                rgba(0, 0, 0, 1) 100%
            );
            /* Chrome10+,Safari5.1+ */
            background: -o-linear-gradient(
                top,
                rgba(137, 255, 241, 0) 0%,
                rgba(0, 0, 0, 1) 100%
            );
            /* Opera 11.10+ */
            background: -ms-linear-gradient(
                top,
                rgba(137, 255, 241, 0) 0%,
                rgba(0, 0, 0, 1) 100%
            );
            /* IE10+ */
            background: linear-gradient(
                to bottom,
                rgba(137, 255, 241, 0) 0%,
                rgba(0, 0, 0, 1) 100%
            );
            /* W3C */
        }
      }
   }
 }

To view the example set up on codepen, click here.

Answer №1

When the :after element is positioned over the div, it can impede the focus and scrolling ability of the element.

To address this issue, consider applying overflow-y: scroll to the section instead.

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 best way to conceal or eliminate slider increments and their corresponding labels in plotly.js?

Is there a way to eliminate or conceal the step ticks and labels of the animation slider? I want to get rid of the slider's step markers (ticks) and the corresponding labels: 'Red', 'Green' and 'Blue' located beneath the ...

Do you have to change the style of each individual element using JavaScript, or is there another method to accomplish this?

Recently, I've been exploring different ways to use JavaScript to globally adjust styles. My goal is to modify the CSS rule that controls the element's style, similar to how you can do it using the Inspector in Webkit. However, after visiting htt ...

Display a "loading..." <div> element while the list is loading, and then remove the <div> element once the list has been loaded

My mobile app features an angularJs/firebase list that takes a few seconds to load. To provide a better user experience, I want to display a simple "List is loading..." message until the items have loaded. I understand that using ng-hide/ng-show methods w ...

"Struggling with vertical alignment in my scenario, any tips on how to achieve

I'm trying to vertically align my texts while ensuring that the green background div covers the entire height of the red color div. Right now, the green div only covers 90% of the red div and I'm not sure why. Can someone please explain what&apos ...

Arrangement of Events in an AngularJS Timeline

https://i.sstatic.net/qtUZb.jpgI am currently working with angularjs version 1.5.0 and I am trying to adjust the layout of my timeline so that all events are displayed on a single side. Does anyone have suggestions or solutions on how I can achieve this? ...

Implement a transition effect for when elements change size using the `.resizable().css` method

I attempted to incorporate a deceleration effect when resizing an element back to its original size using the resizable method. The slowdown effect should only trigger during the click event (when the "Click-me" button is pressed), not while manipulating ...

Utilizing CSS to Create Fixed Position Elements

How can I create a CSS Style with a fixed position property for a div? When I place this particular div inside another div containing text, the fixed-positioned div overlaps the text, causing it to be hidden. I want to align the text and image divs next ...

After pressing the button to access the sidebar, all I see is a plain white screen

I've been diligently working on a school project, but I'm encountering some issues with the Sidebar button in the top left corner. Whenever I click on the button, it opens up to display a blank white page. Can anyone provide me with some assistan ...

What impact do negative margins have on the width of my webpage?

Take a look at this example: This demo features an outer div that is 200px wide to set the page width. Inside, there is an inner div that is 400px wide, but with negative margins of -100px on both sides. The goal here is for the browser to recognize the ...

Having trouble adjusting the grid's width property

My personal page features a section dedicated to displaying my skills and proficiency in various programming languages (although it may not be entirely accurate). I am struggling to adjust the width of the Skill grid to match the layout of the other grids ...

Challenge with placing a child element in CSS on Firefox and Internet Explorer

I am having trouble aligning the toggle eye of the password field using CSS. The positioning works well in Google Chrome, but it is not working in Firefox and IE. As a beginner in web development, I have tried to find a solution but haven't been succe ...

What is causing Gmail to remove my class?

Currently I am developing an email template and have incorporated a CSS class specifically for mobile devices, excluding desktops. However, I have encountered an issue where Gmail on desktop is removing the class entirely. I'm puzzled as to why this ...

Styling HTML during the loading of Angular JS

I have HTML code block that I need to control the visibility of using an Angular variable <div class={{visibilityCss}}> Show/Hide Area </div> In Angular, I can set $scope.visibilityCss = 'hide' or $scope.visibilityCss = 'sh ...

Conditionally Changing the Display Attribute of an HTML Button based on the Result of a jQuery Get() Request

Hello there! Recently, I encountered an interesting problem while working on a browser extension that I have been tinkering with for quite some time. The issue revolves around the dilemma of showing or hiding a specific button based on an 'if stateme ...

Remove the pound symbol from the web address

Hi there, I'm currently facing a small issue with my navigation bar. Right now, it takes me to specific sections on the page by linking to them with an ID. However, this results in the "#" character followed by the section name appearing in the URL, l ...

1. "Retrieving first-level nodes using Jsoup"2. "Getting exclusively

Recently, I came across an XML tree that needed to be parsed using Jsoup. The structure looked something like this: <?xml version="1.0" encoding="UTF-8" ?> <nodes> <node> <name>NODE 1</name> <value1> ...

Is it feasible to overlay a PNG image on top of a button while still allowing the button to be clickable?

Can you place an image (.png) on top of a button and still make the button clickable? https://i.sstatic.net/9Z8nH.jpg ...

What strategies should be employed to manage data-driven input in this particular scenario?

In the process of creating a small webpage, I have designed 2 navigation panels - one on the left and one on the right. The leftNav panel contains a list of different flower names. While the rightNav panel displays images corresponding to each flower. A ...

inadequately arranged in a line

In Bootstrap 4, I have created this form group that you can view in this fiddle: <div class="m-portlet__body"> <div class="form-group m-form__group row"> <label class="col-lg-2 col-form-label"> Email Address ...

The ::before pseudo element is malfunctioning when used in the makeStyles function

I am currently utilizing the makeStyles function in React, but I seem to be facing an issue where the content within the ::before pseudo-element is not displaying. Strangely enough, when the content is an image it works fine, but text does not render. Jus ...