The overlay div with additional css does not correctly cover the Ionic header bar that is placed within the ion-content

I have a unique challenge of creating a customized popup that is based on a dynamic template, background, and actions, in order to manage an overlay div.

The requirement is for this div to be placed inside the ion-content.

However, there seems to be an issue where the overlay div cannot cover the header, possibly due to its high z-index compared to other elements on the page.

A similar problem has been discussed on the Ionic portal here, but a solution has not yet been found.

Feel free to review the source code snippet below, which is currently being used in my application.

<!---HTML source -->

<ion-app>
  <ion-header>
   <ion-toolbar>
    <ion-title>Hello</ion-title>
   </ion-toolbar>
 </ion-header>
 <ion-content>
       <div class="overlay">Test</div>
 </ion-content>
</ion-app>


/** css source */

.overlay {
         position: fixed;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
}

I am seeking assistance in resolving this CSS-related issue. Any help would be greatly appreciated.

Answer №1

Thank you for providing the demo. I have reviewed its source code below:

https://stackblitz.com/edit/ionic-angular-v5-ryaoho

In your CSS, there is a comma that is causing an issue with setting the z-index for the overlay correctly:

p {
  font-family: Lato;
}
.overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 99999, // Please remove this comma

}

If you eliminate the comma, you will notice that the overlay now covers all content on the page, including the header.

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 approach to incorporate this D3.js HTML element into my AngularJS project for easy manipulation?

I've been experimenting with creating graphs using the D3.js graphical library for Javascript on my webpage. Currently, I can draw a gray line on an SVG using HTML and a red line using Javascript on a new SVG container created in Javascript. However, ...

How can one address the issue of undefined data within table cells?

I have encountered an issue while reading and displaying an XML file on a webpage using a JavaScript script. The problem arises when the page loads, and the information inside the cells of the table shows as "UNDEFINED". The intended display should include ...

Angular's dynamic table feature efficiently updates only the modified data before sending it to the API

Currently, I am working on implementing a dynamic table feature in Angular that retrieves data from the backend first (Express) and then populates the table. Additionally, I want to be able to add new rows to the table and send only the modified data to th ...

Is there a way to determine the number of Waypoints that are currently toggled simultaneously?

I have a collection of elements arranged in rows and I am applying Waypoints instances to them. <div class="row"> <div class="col-xs-6 col-sm-4"><div class="foo"></div></div> <div class="col-xs-6 col-sm-4"><div c ...

Remove three text elements to the right of the small icon with no line breaks

I am trying to align three text items to the right of a smaller left-floated icon without causing the text items to wrap. div { width:30%; } div i { margin-right:0.75em; padding:0.5em; float:left; color:#fff; border-radius:50%; ...

Having trouble implementing ngmodel and pipe in p-calendar from primeng

I am currently working on implementing p-calendar from ng-prime along with ngmodel for binding a date retrieved from the server <p-calendar [(ngModel)]="selectedDate" [locale]="es" [hidden]="!editing" dateFormat= ...

Changes in model not reflected in the view

In my Angular app (5.2.3), I have implemented a feature to display a login/logout button in the top right corner of the page. The functionality involves silently logging the user in using an external Open ID Connect provider and then displaying the user&ap ...

Encountered a problem with NGX Infinite Scroll while implementing it in my Angular project

I'm currently using Angular version 11.0.4 and I've been working on implementing infinite scroll functionality with the help of an npm package. Following all the steps outlined in the documentation at https://www.npmjs.com/package/ngx-virtual-scr ...

Prevent vertical scrolling on touch devices when using the Owl Carousel plugin

Is there a way to prevent vertical scrolling on Owl Carousel when dragging it horizontally on touch devices? It currently allows for up and down movement, causing the whole page to jiggle. If anyone has a solution, I can share the JavaScript file. Appreci ...

Generating a CSS pulsating animation starting from the border towards the center

I originally set out to create a code pen with the desired effect, which you can view here: https://codepen.io/oli_js/pen/KKPGZLm?editors=1100 However, the pulse effect in my code radiates outwards from the center point. What I actually want is for the in ...

Personalized scroll bar within a Chrome application

I'm currently working on customizing the scrollbar for my Chrome App using CSS and I have encountered an issue with rule #2: section { overflow: auto } section::-webkit-scrollbar { width: 5px ; } Oddly enough, when I apply the second rule, Chrom ...

How to stop the parent element from activating :active pseudoclass when the child element is clicked using CSS

JSFiddle Upon clicking the button, it is noticeable that the :active pseudoclass is activated for the parent div. Is there a way, using only CSS (or any JavaScript library), to prevent the :active pseudoclass from being triggered when the button is clicke ...

Creating a design using HTML and CSS that involves an overbar matching square root symbol

Is it possible to achieve the following layout using HTML4 and/or CSS in a correct manner? √¯¯¯¯¯¯φ·(2π−γ)     ↑ ← ←  ← ...

Adding HTML created by PHP to a document fragment

I am trying to add a large amount of HTML generated by PHP (5000 div elements) to a document fragment and then append it to the body of the page. Here is an example of the HTML: <div itemscope itemtype="http://schema.org/Article"> <link itemprop ...

Instructions for launching an Ionic project on a mobile device using a PHP backend

I'm curious about how to test my Ionic application with a PHP backend on an Android phone. The database is in phpMyAdmin. Can you help me figure out how to run it and test it on my device? ...

Can the base tag be used conditionally?

My Angular app is set to be deployed on two different sites with the same code base. I have configured the base tag for site A like this: <base href="https://A.com/"> However, for the second site (site B), I need to use a different base tag: <b ...

Ways to make an area map more transparent

I'm encountering an issue with HTML opacity... Currently, I've implemented opacity using CSS but it's not functioning correctly. Below is my HTML and CSS code: <area shape ="rect" class="transbox" coords ="0,0,30,22" href ="test1.htm" ...

Troubleshooting HTTPS requests issues on iOS version 12

Upon testing my Ionic Angular app on iOS v12, I noticed that the https requests are failing to reach my backend. After confirming that my app is functioning properly and only encountering this error on iOS versions equal to or greater than v12, When debu ...

How can I resolve the issue of background-size not functioning properly?

Struggling to set a background-image with the 'cover' size property inside a div. Despite trying different values for background-size, the image always shows up in full size within the div. I've searched for similar answers on SO, but nothi ...

Adjusting the grid's background color in Bootstrap to cover the entire area, including the edges it doesn't quite reach

Apologies if my wording is unclear, but suppose I have the following HTML and CSS: <body> <main role="main" class="container"> <div class="row"> <div class="col-sm-4">1</div> <div class="col-sm-4">2</div> ...