Setting Safari image height within a CSS grid

Having trouble in mobile safari with an image exceeding the grid height, but Chrome is displaying fine... This is how it appears in Chrome:

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

Here’s how it looks on my iPhone:

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

This is a simplified version of my code:

          <div
        style={{
          gridTemplateColumns: '25% 55% 20%',
          display: 'grid',
          minHeight: '20vh'
        }}
      >
          <img
            src={this.props.parent.sliderPhotos[0]}
            style={{
              objectFit: 'cover',
              width: '100%',
              height: '100%'
            }}
          />

        <div
          style={{
            backgroundColor: 'yellow',
          }}
        ></div>
        <div
          style={{
            backgroundColor: 'red',
          }}
        ></div>
      </div>

Trying to style with height 100% and max-height has not been successful. Also flex-direction: "column" and padding-top: "100%" have not worked.

Any suggestions on how to make this compatible with both browsers?

Answer №1

  • There seems to be an issue with mobile safari, which is discussed in this tweet
  • Take a look at this: GitHub repository

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

React JS: Modifying State in Child Component to Trigger Updates in Parent Component

When it comes to the application I am currently working on, a detailed approach is essential in order to address the issue at hand. Thank you for taking the time to read and assist me! My project involves developing a language assessment Application using ...

Having trouble getting your React project to work because NPM start won't cooperate? Here are some troubleshooting tips

Hello, I recently downloaded a React project from https://github.com/fabiau/jc-calendar. However, when I try to run npm start, I encounter error messages. I have attempted to use "NPM Fund" and "NPM Update", but unfortunately, neither of them resolved the ...

Arranging flex items in a row next to another flexbox container with aligned direction

Is it possible to mix flex directions column and row within the same div? Let's take a look at an example: https://i.sstatic.net/Gumu5.png .container { display: flex; } .container .left { display: flex; align-items: center; flex: 1; } .co ...

Can you point me in the right direction for declaring the ImageObject format in Angular?

To create an Image Slider similar to the one shown here, I need to load images from a source. However, I'm unsure about where exactly in the file (possibly in the component.ts?) I should declare them: imageObject: Array<object> = [{ ...

My ability to click() a button is working fine, but I am unable to view the innerHTML/length. What could be the issue? (NodeJS

Initially, my goal is to verify the existence of the modal and then proceed by clicking "continue". However, I am facing an issue where I can click continue without successfully determining if the modal exists in the first place. This occurs because when I ...

Tips for Customizing the Appearance of Material UI Select Popups

My React select component is functioning properly, but I am struggling to apply different background colors and fonts to the select options. https://i.stack.imgur.com/kAJDe.png Select Code <TextField fullWidth select size="small" nam ...

How to efficiently handle data binding for multiple users sharing common inputs within a table on an ASP.NET Razor Page?

I am currently working on a project that involves populating a table with member information such as name and email. Within this table, there are columns where a "warning" can be entered for each member, along with a textbox for additional information rega ...

Prevent individual elements from shifting around on browser resizing within a React form

Having issues with a React form that includes an image gallery and input fields. import React, { Component } from 'react'; import ImageGallery from 'react-image-gallery'; import { Container, Row, Col, InputGroup, Button, FormControl, ...

Tips on personalizing MUI X Data Grid Toolbar to exclusively display icons

`function EnhancedToolbar() { return ( <GridToolbarContainer> <GridToolbarIcon icon={<FilterListIcon />} /> <GridToolbarIcon icon={<ViewColumnIcon />} /> <GridToolbarIcon icon={<SettingsEthernetIc ...

Managing sessions and cookies for Firefox forms

On my webpage, there is a poll form where users can vote and see the results through an ajax request. When a user votes, a cookie is created to prevent them from voting again upon returning to the page. However, I have encountered an issue with Firefox wh ...

Tips for positioning a container at the center of the screen

I am having trouble centering text in the middle of my screen. Despite my efforts, it seems like it's not working as expected. Would someone be able to review the following index.html code and point out where I might be going wrong? <!DOCTYPE html& ...

My objective is to ensure that this is validated, and in the absence of any errors, proceed to send out

I'm a beginner in php and am assisting a non-profit organization with an exit survey for their volunteers. I have integrated the following script above my first html tag, and I can successfully display it when a field is empty on submit, but it doesn& ...

Having trouble getting the image source to function properly with the Bootstrap Carousel feature in Django

I am struggling to include an image in my bootstrap carousel but the image is not loading. {% extends 'base.html' %} {% block html %} {% load static %} <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> </head> ...

"The onkeydown event dynamically not triggering for children elements within a parent element that is contentEditable

Can anyone offer some insights into why this code isn't functioning as expected? My goal is to attach the listener to the children elements instead of the body so that I can later disable specific keystrokes, such as the return key. <!DOCTYPE html ...

Guide on incorporating a "choose file" button to store an image in a mongodb database for a meteor application

I recently created a form for my project which includes typical text inputs like "First Name", "Last Name", and "Address". However, I am currently facing a challenge due to my limited knowledge in Meteor, as well as HTML and Javascript. Despite searching e ...

What is the best way to activate materialise pop-up menus in a React application?

Looking to enhance my React app by adding a NavBar with dropdown functionality. Here's the code snippet: <ul id="dropdown1" className="dropdown-content"> <li><NavLink to="/create">Create lesson ...

Tips for creating a centered Reindeer

My reindeer code seems to be a bit off-center. Even though I followed a tutorial, my reindeer is not aligning properly as shown in the tutorial. Here is all the CSS code for the reindeer: .reindeer { height: 510px; width: 350px; position: ab ...

Tips on customizing the clear button icon functionality in Material UI Autocomplete?

Below is the code snippet I am currently working with: <Autocomplete id='combo-box-demo' options={companies} getOptionLabel={getOptionLabel} ...

Improving loading time for pages requiring jQuery to render

Currently, I am utilizing the Google PageSpeed service to enhance the loading time of my website. It is hosted on GAE/P, but that detail may not be crucial in this context. There are several resources my page relies on: Bootstrap (css and js) jQuery (js ...

Store user input in a paragraph

I want to create a unique program that allows users to input text in a field, and when they click "Start", the text will appear in a paragraph backwards. I plan to use Html, jQuery, and CSS for this project. Can anyone provide guidance on how to achieve th ...