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%;
}

https://i.sstatic.net/Emw5f.png

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

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

https://i.sstatic.net/abXmH.png

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:

https://i.sstatic.net/rHOJI.png

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

Having trouble resolving a setInterval problem with JavaScript?

Yesterday, I learned about the setInterval function which allows me to execute a task or function after a specific amount of time. While I have successfully implemented the interval in my code, it keeps adding new lines with the date each time. What I re ...

changing UITableView cell size at runtime

Currently, I am fetching data asynchronously from a JSON server and populating my table view cells with this information. My goal is to dynamically adjust the cell height based on the text content. While I have come across solutions online, they all seem t ...

using an SVG mask declared in HTML to apply masking

I've been experimenting with masking using an SVG shape that I created in the HTML content. I've tried various options: mask, -webkit-mask mask-image, -webkit-mask-image different MaskUnits and MaskContentUnits mask-type: luminance or not Desp ...

PHP: Parsing HTML Tables with Headers and Irregular Body Rows Using Simple HTML Dom Parser

In an HTML table, the data is structured as follows: Header 1 has Row 1, Header 2 has Row 2 and Row 3, while Header 3 has Row 4, Row 5, and Row 6. <table> <thead> <tr> <th>Header 1</th> </tr> </thead& ...

Struggling to make addClass and removeClass function correctly for the development of the unique "15 puzzle" game

I am currently in the process of creating a version of "the 15 game" using jQuery in HTML. You can find more information about the game on this page. The objective of the game is to rearrange a table of "boxes" in ascending order from 1 to 15. Below is th ...

How to navigate to the "not now" button in Instagram notifications with Selenium and Python

I'm currently working on a custom "Instagram bot" to log in to Instagram. Although I've managed to bypass the login screen, I'm encountering an issue with a popup message that says: https://i.stack.imgur.com/OMA6h.png from selenium import we ...

Utilizing a function within a span element

Can anyone help me figure out what I'm doing wrong while trying to toggle between a span and an input text field using the on function? If you want to take a look, I've created a fiddle for it here User Interface <div> <span >My va ...

The reliability of jQuery posting varies

My current setup involves using jQuery to send data to an external source with the code snippet provided below. As part of the process, I'm also ensuring that all input fields are filled out correctly. However, there has been a strange issue where the ...

Error: The column 'joinedactivities.searchact id = searchact.id' is not recognized in the 'on clause'

I keep encountering this particular error: Error: Unknown column 'joinedactivities.searchact id = searchact.id' in the 'on clause'. I have meticulously inspected the table names and even attempted to make modifications, but multiple err ...

Tips for automatically hiding a button when the ion-content is being scrolled and displaying it again once scrolling has stopped

I have implemented a scroll function event in my HTML file using the following code: <ion-content (ionScroll)="scrollFunction($event)"> <ion-card *ngFor="let product of products" no-padding> <ion-item class="bigclass"> <i ...

How can I use JQuery to enable or disable checkboxes upon loading?

I am looking to implement a feature where the checkboxes are enabled when the .group is checked and disabled when it is unchecked. Although I can toggle between them, I'm facing difficulty in disabling the unchecked checkbox using the .group. Upon lo ...

Every time I attempt to utilize pdf.js, I encounter a Cross-Origin Request block

When attempting to read a local PDF file using pdf.js, I included the following script tag: <script src="https://cdn.jsdelivr.net/npm/pdfjs/build/pdf.min.js"> </script> To check if it was working, I added a simple console.log: ...

Responsive Video Embed Using Bootstrap-5

I'm facing some challenges with Bootstrap responsive video embedding. It seems like the parent container is not responding to changes, only the content within the <iframe> tag is being responsive. Any idea what might be going wrong? .embed- ...

What is the best way to position the label above the input text in a Material UI TextField component with a Start Adornment?

Struggling to figure out the right Material UI CSS class to style a reusable TextField component? You're not alone. Despite tinkering with InputLabelProps (specifically the shrink class), I can't seem to get it right. Here's the code snippet ...

The ajax method for loading an xml file results in displaying the undefined message

When attempting to fetch content from an xml file using ajax, the page initially displays "undefined". However, upon refreshing the page, the content loads successfully. Take a look at my code snippet below: $.ajax({ type: "GET", url: "xm ...

limited growth of float variable

I am utilizing CSS code to create column a and column b, using float in the code to dynamically expand column a as content is added to column b. However, this expansion is not occurring as expected. To see my code, please visit http://jsfiddle.net/hadinetc ...

Content Security Policy directive violation: Chrome extension policy error occured due to refusal to execute inline event handler

I've been working on a chrome extension to perform a simple task, but I've hit a roadblock with one line of HTML code that's causing issues with setting the correct permissions. Despite my efforts, I'm stuck on what exactly needs to be ...

unable to interpret information

I've encountered an issue with posting data to my webpage (page3.php). Despite using $test=$_POST['radio_second']; on the page, the test variable remains empty. Any help in resolving this would be greatly appreciated. Thank you! <p> ...

IE11 experiencing issues with font loading

I need help troubleshooting why the fonts are not loading properly in the body section of my articles, specifically when viewed in Internet Explorer. Take a look at an example article here: I am fetching from this CSS file: , and I have included the nece ...

OnePageCheckout may result in empty boxes being displayed due to OneStepCheckout CSS styling

Seeking advice for an issue with the Magento OneStepCheckout module. Upon checkout, there are three columns: customer data (working fine), payment options (selectable via checkbox), and details about the chosen payment method. Unfortunately, the informati ...