I’m trying to implement a full-screen image preview modal. My current implementation, even with ion-content padding removed and height: 100% on the image container, doesn’t center the image truly across the entire screen. It appears to be centered only within the ion-content area, below where the ion-header sits, pushing the image down.
What I’ve tried:
Using position: fixed or position: absolute within the ion-header. This allows the image to center on the full screen, but I’m unsure if this is considered a good practice.
Omitting ion-header entirely and attempting to create a custom top bar (with a close button) using position: absolute or fixed directly within the modal’s main template.
I’m looking for the most robust and recommended approach to achieve true full-screen image centering in an Ionic modal, ensuring the ion-header (ideally transparent) can float over the image without affecting its vertical alignment.
I don’t completely understand the problem. Are you using ion-modal? If not, why not? It should overlay the entire screen and you should be able to center your image.
Your ion-header is part of the modal or part of the page where the modal is being opened from?