Incorrect height of div on iPhone 6 and 7 is observed when utilizing flexbox and setting the height to 100% dimensions

I'm experiencing an issue with the display on iOS devices, specifically iPhone 6 and 7. I am creating a news card layout where I set the content height to 100%. However, on these specific iPhone models, the height is being displayed incorrectly (as seen in the browserstack screenshot):

.wrapper__content {
  padding: 18px;
  flex: 1 1 auto;
  height: 100%;
}

Interestingly, when I remove the height property from .wrapper__content, it works as expected:

.wrapper__content {
  padding: 18px;
  flex: 1 1 auto;
}

This issue seems to only occur on iPhone 6/7 (possibly other smaller models too), as it works fine on newer iPhones like 8 or X with the same iOS version. It functions correctly on all browsers I tested (Chrome, Firefox, Safari, Internet Explorer, Edge). So, I'm trying to understand why this discrepancy exists.

In my project, it's necessary for me to use height: 100% on .wrapper__content. The issue is not resolved by simply removing the height property. Does anyone have any insights into why this isn't working and how to fix it while still using height: 100%?

Here is a screenshot from browserstack showing that the height: 100% works on iPhone X with the same iOS and Safari version:

The codepen snippet for reference can be found here: https://codepen.io/STWebtastic/pen/rJjVXX

body {
  box-sizing: border-box;
  background-color: #f0f0f0;
}

.wrapper {
  max-height: none;
  height: auto;
  width: 550px;
  box-shadow: 1px 13px 39px -5px #e2e2e2;
  display: flex;
  flex-direction: row;
}

.wrapper__image-container {
  flex: 0 0 auto;
}

.wrapper__image {
  width: 100%;
  height: auto;
  display: block;
}

.wrapper__item {
  background-color: lightcoral;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  margin-right: 30px;
}

.wrapper__content {
  padding: 18px;
  flex: 1 1 auto;
  height: 100%;
}

.wrapper__content--without-height {
  padding: 18px;
  flex: 1 1 auto;
}

.wrapper__title {
  margin-bottom: 27px;
  max-height: 80px;
  width: 100%;
}

.wrapper__text {
  margin-bottom: 20px;
  max-height: 75px;
}

.wrapper__title,
.wrapper__text {
  overflow: hidden;
  flex: 0 0 auto;
}

.wrapper__date {
  flex: 0 1 auto;
}
<div class="wrapper">
  <div class="wrapper__item">
    <div class="wrapper__content">
      <h3 class="wrapper__title">Default title</h3>
      <div class="wrapper__text">Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. Nulla porttitor accumsan tincidunt. Donec rutrum congue leo eget malesuada. Sed porttitor lectus nibh.</div>
      <p class="wrapper__date">08.02.2018</p>
    </div>
  </div>

  <div class="wrapper__item">
    <div class="wrapper__image-container"><img class="wrapper__image" src="http://accessasiatours.com/wp-content/uploads/2017/11/panda.jpg"
        alt="Testimage"></div>
    <div class="wrapper__content">
      <h3 class="wrapper__title">Default title</h3>
      <div class="wrapper__text">Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. Nulla porttitor accumsan tincidunt. Donec rutrum congue leo eget malesuada. Sed porttitor lectus nibh.</div>
      <p class="wrapper__date">08.02.2018</p>
    </div>
  </div>
</div>

Answer №1

To fix the problem with older IOS versions, it is recommended to delete the flex-direction: column; line from the .wrapper__item section.

Answer №2

Based on the latest information, a solution can be achieved by removing the flex-direction: column; and instead utilizing the flex-wrap: wrap;

Visit this PEN for more details.

We hope this explanation proves to be useful.

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

distinct identifier for an HTML element that is compatible across all web browsers

Is there a specific identifier for HTML tags on a webpage? I noticed Mozilla uses uid, but is it compatible with all browsers? (I'm not concerned about IE6...) I've come across Unique identifier for HTML elements but they didn't mention t ...

How to retrieve the current event handler's value with jQuery

To assign an onclick event handler using jQuery, I simply use the following code: $('#id').click(function(){ console.log('click!'); }); Now, my question is how can I retrieve a reference to the function that is currently handling th ...

Using jQuery, wrap two specific HTML elements together

I am working with a set of elements: <div id="one">ONE</div> <div id="two">TWO</div> <div id="three">THREE</div> <div id="four">FOUR</div> <div id="five">FIVE</div> My goal is to wrap a DIV tag ...

Using jQuery to select and animate several elements simultaneously without repeating the animation

Issue Summary (Fiddle): I'm trying to make all elements fade out simultaneously when clicked, but the current code causes the target to trigger three times resulting in three alert() calls. I want them to fade together without using a wrapper element ...

Why is it that lists always begin outside of the enclosing element?

I've always found this incredibly frustrating. Why do lists behave this way? When you set the margin and padding to 0, you would expect them to align normally with the surrounding text on the left, right? But no. That's where the text within the ...

Unable to choose the div element with id ":1"

Just starting out with web development, and I have a div element with the following attributes: <div class="" id=":1" role="treeitem" aria-selected="false" aria-expanded="false" aria-level="1" aria-labelledby=":1.label" aria-setsize="10" aria-posinset= ...

CSS navigation bar (background gradient problem)

I have encountered an issue with my multi-tier navigation menu where tiers below tier 1 are displaying an unexpected block to the left of the options. I suspect this problem is related to the background gradient applied, but I haven't been able to fin ...

Issue with content overlapping when hamburger icon is tapped on mobile device

When the hamburger menu is pressed on smaller screens, I want my navbar to cover the entire screen. To achieve this, I included the .push class in my code (see the jQuery and CSS) to trigger when the .navbar-toggle-icon is pushed. However, after implemen ...

Refresh meta tags in a Next.js/React app

In the process of optimizing a website for SEO, I am facing the challenge of updating the meta description's content dynamically without using any third-party libraries. While I have successfully implemented the functionality, it currently requires a ...

Modify the pseudo element when a different class is active

I've encountered an issue while attempting to modify the after pseudo element when the .active class is applied. Despite my efforts, it doesn't seem to be functioning as intended. My current project setup involves using scss with Vue. I have tri ...

Interactive image popups with JavaScript

Seeking assistance in generating a popup when selecting an area on an image map using Javascript. As a novice in JS, I have successfully implemented popups for buttons before but encountered issues with this code within the image map - the popup appears br ...

Overflow - conceal the scrollbar and prevent scrolling without cutting off the element

Whenever I implement the code snippet below: body { overflow: hidden; } The overflowing element gets clipped. However, when I try this code instead: body { overflow: auto; } The element is no longer clipped, but now a scrollbar appears where it ...

Accessing an element by its ID with the help of a looping

Looking to retrieve a string from my database and insert it into my paragraphs: <p id="q_1"></p> <p id="q_2"></p> The following code works correctly: $.get("bewertung/get/1", function (data) { document.getElementById("q_1") ...

CSS Dropdown Menu Malfunctioning

I recently created a navigation bar using some online tutorials, and everything seems to be working fine except for the drop-down menu. I've been struggling with it for hours and can't seem to find a solution. Any help would be greatly appreciate ...

What methods does the W3C CSS Validator use to recognize a CSS3 document?

Help Needed! Can someone tell me how to specify a CSS3 file for validation by the W3C? In HTML5, we use <!DOCTYPE html>, but what should we use in a CSS file? Whenever I try to validate my CSS file containing CSS3 elements like @font-face and box- ...

What is the process for extracting the background color from a typescript file in Angular and connecting it to my HTML document?

My typescript array population is not changing the background color of my div based on the values in the array. I've attempted to set the background using [style.backgroundColor]="statusColor[i]", where statusColor is an array declared in my typescrip ...

Minification of CSS - Vuetify

While working on my Nuxt project with Vuetify, I noticed that the page source is quite lengthy with 26k lines of code, most of which is generated by Vuetify's CSS. On comparing it with other pages, I see shorter code with difficult-to-read CSS. Is the ...

Extracting information from several span elements within the main span class using BeautifulSoup

I'm currently attempting to extract data from the following HTML code: <span class="double-line-ellipsis"> <span> ₹ 2800 for 2 (approx) </span> <span> | </span> <a data-w-onclick="stopClickPropagation|w1-re ...

The functionality of jQuery's .hide method is not effective in this specific scenario

HTML section <div class="navigation-bar"></div> Jquery & JavaScript section function hideUserDiv(){ $('.ask-user').hide(); } var ask = '<div id="ask-user" style="block;position:absolute;height:auto;bottom:0;top ...

Unveiling concealed content with JQuery

Here is a link to my pen: http://codepen.io/anon/pen/IszKj I am looking to achieve the functionality where clicking on either "any status" or "any date" will reveal a hidden div containing a list of options. My main query is about the best approach to ta ...