Units of VH and VW with Bizarre IOS Mobile Browser Display

For my new project, I decided to use relative units which seemed like a good idea at the time. While working on it, I diligently checked on Chrome emulation to ensure everything looked good on various devices.

After pushing it to Heroku, everything appeared fine on my MacBook. However, when I viewed it on my iPad, I was ready to toss it out the nearest window...

#bannerTop {
    position:relative;
    text-align: center;
    width:100vw;
    height:70vh;
    min-height: 70vh !important;
    max-height:70vh !important;
    background-image: asset-url('skycloudsalpha.jpg');
    background-repeat: no-repeat;
    background-position: 50% 75%;
    z-index:-1;
}

I suspect the issue may be related to using VH units. Could there be some other underlying problem causing this discrepancy? Debugging is proving tricky as everything looks fine in the emulator but not on the actual device. I've already spent three hours on this and would greatly appreciate any help.

Thank You!

Answer №1

For more information, visit caniuse.com

iOS7 has partial support for viewport units due to the buggy behavior of the "vh" unit.

Here are some known issues:

  1. Chrome lacks support for viewport units in various properties until version 34.
  2. iOS Safari (versions 6 and 7) does not fully support viewport units in certain properties.
  3. iOS 7 Safari may reset viewport unit values after a period of inactivity.
  4. Internet Explorer 9 misinterprets vh as pages in print mode.
  5. iOS 7 Safari may recalculate widths and heights set with viewport units upon orientation changes.

To learn more about this buggy behavior, check out:

You can also use a polyfill to address these issues: https://github.com/rodneyrehm/viewport-units-buggyfill

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

Ways to update list item text with jQuery

I am attempting to create a button that can replace the content of a list item. Although I have looked at other solutions, I keep encountering this error message: Uncaught TypeError: Object li#element2 has no method 'replaceWith' I have experime ...

Jquery's mouseclick event selects an excessive number of elements

Is there a way to retrieve the ID of an element when it is clicked, only if it has one? I currently have this code set up to alert me with the element's ID: $("[id]").click(function(event) { event.preventDefault(); var id_name = $(this).attr ...

A method to conceal a section in a table view by toggling a switch in a different section on iOS

Currently working on developing a settings page similar to iOS. In the WiFi section, when the switch is toggled, the other sections of the network should be hidden and vice versa. ...

Tap and swipe to bring a view down

Currently, I have a UIView situated at the top of the interface, right below the status bar, but only the bottom part of it is visible. I am looking to implement a functionality where users can drag down the red UIView to fully reveal it, similar to how t ...

The error detected in the W3Schools validator pertains to CSS for audio elements that do not contain

Could somebody kindly explain why this code is being flagged as an error on w3schools? audio:not([controls]) { display: none; height: 0; } ...

What is the best way to expand the width of my Bootstrap 4 navbar dropdown menu?

Need help creating a full-width dropdown for a Bootstrap 4 navbar using the standard boot4 Navbar? Check out the navbar template I am currently working with. Here is an example of how I want it to look: Desired design image link <nav class="navbar fix ...

Uniform dimensions for HTML tables

When creating an HTML document with consecutive tables that need to be formatted the same way, it can be challenging. Browsers will often render columns of one table wider than another simply due to content width. The typical solution is to hard-code colu ...

Deciphering Twitter's JSON stream on iOS devices

Playing around with the JSON parser in iOS, I've got it working smoothly for a simple example. However, I'm curious about how to parse something more complex like a Twitter trends JSON: { "trends": { "2011-03-13 11:42:17": [ ...

Retrieve the image information from a specified element in the Document Object Model

Is it possible to extract the image data of a DOM element using standard JavaScript or browser extensions? I'm considering scenarios where: Creating an offscreen DOM element Populating it with dynamically styled CSS content Retrieving its image dat ...

Error: The Vue bind object property cannot be read because it is undefined in the class binding

I'm attempting to associate a class with an object property, but I encounter an issue when trying to trigger the @click event on the list object - the console states that it cannot read the isSelected property of the object. My goal is to activate a c ...

Could Flexbox CSS be used to create a responsive layout like this?

Appreciate your help in advance. I am facing a challenge with the current layout. <article> <section class="content">1</section> <aside class="ads">2</aside> <section class="comments">3</section> < ...

Tips for dynamically including classes in NextJS component with class names from CMS?

I am in search of a solution that will offer some styling flexibility within a CMS to dynamically alter the classes of specific components within my NextJS application. The code snippet I'm working with is as follows: pages/index.js: ... import clien ...

Exploring HTML segments with Python and BeautifulSoup

As a beginner, I am exploring web scraping examples from Automate the Boring Stuff. My goal is to create a Python script that automates downloading images from PHD Comics using the following steps: Identify the image link in the HTML and download it. ...

Are CSS generated elements limited to text content only?

Can CSS generated content be used for more than just text? Take for example the code snippet below, where the span is displayed as text rather than creating a new span element. .addbefore:before { content: "<span>dfsd</span>"; } ...

javascript ajax is not executing correctly

With the help of Ajax, I have developed a console that allows me to dynamically execute PHP functions. This is how it appears https://i.sstatic.net/Wj2Ww.png The issue arises when the console gets filled with numerous commands, making it difficult to rea ...

Is there a Joomla extension available that can display or conceal content upon clicking?

Looking to enhance my Joomla site by installing a plugin that allows me to toggle the visibility of content with a click, similar to how FAQ sections work on many websites. Question 1 (click here for the answer) { Details for question 1 go here } Questi ...

Having trouble retrieving data from a remote URL with angucomplete-alt

Utilizing the angucomplete-alt directive for creating an autocomplete list through a get request. Successfully fetching results from the Github API: <div angucomplete-alt id="ex5" placeholder="Search projects" pause="500" selected-object="selectedProj ...

Concealing the pagination buttons for next and previous in Material-UI TablePagination

Is there a way to remove the next and prev buttons in the TablePagination component without affecting the position of the "Showing ..." text? Should I handle this through CSS styling or by configuring the component settings? https://i.sstatic.net/7EkKd.pn ...

Can you guide me on implementing an onclick event using HTML, CSS, and JavaScript?

I am looking for a way to change the CSS codes of the blog1popup class when the image is clicked. I already know how to do this using hover, but I need help making it happen on click instead. The element I want to use as the button; <div class=&quo ...

Creating a SVG polygon using an array of points in JavaScript

Consider the following array containing points: arr = [ [ 0,0 ], [ 50,50 ], [ 25,25 ], ]; I would like to create an SVG polygon using this array. Initially, I thought the code below would work, but it doesn't: <polygo ...