Home > Web Front-end > CSS Tutorial > Here are a few question-based article titles that encapsulate the content: Direct and Informative: * Why is window.innerHeight Different from window.outerHeight in iOS 7 iPad Landscape Mode? * How t

Here are a few question-based article titles that encapsulate the content: Direct and Informative: * Why is window.innerHeight Different from window.outerHeight in iOS 7 iPad Landscape Mode? * How t

Patricia Arquette
Release: 2024-10-26 04:10:27
Original
883 people have browsed it

Here are a few question-based article titles that encapsulate the content:

Direct and Informative:

* Why is window.innerHeight Different from window.outerHeight in iOS 7 iPad Landscape Mode?
* How to Fix the 20px Discrepancy with Window Heights in iOS 7

iOS 7 iPad Safari Landscape Layout Discrepancy

When using an iOS 7 iPad in landscape mode, a puzzling issue arises with web apps where window.innerHeight and window.outerHeight don't align. This 20px difference results in navigation elements being obscured and absolute positioning being misaligned at the bottom of the screen.

To address this issue and prevent it from interfering with user experience, a workaround can be implemented. By absolutely positioning the body element specifically in iOS 7:

body {
    position: absolute;
    bottom: 0;
    height: 672px !important;
}
Copy after login

Regrettably, this approach simply shifts the extra space to the top of the page instead of resolving it. An alternative solution that has proven effective is modifying the positioning to fixed:

@media (orientation:landscape) {
    html.ipad.ios7 > body {
        position: fixed;
        bottom: 0;
        width:100%;
        height: 672px !important;
    }
}
Copy after login

Additionally, a script can be used to detect iPad devices running iOS 7:

if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
    $('html').addClass('ipad ios7');
}
Copy after login

The above is the detailed content of Here are a few question-based article titles that encapsulate the content: Direct and Informative: * Why is window.innerHeight Different from window.outerHeight in iOS 7 iPad Landscape Mode? * How t. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template