Overlapping background images of flex elements in Safari

This webpage is designed as a single-page layout using Gatsby:

<div className='mainContent'>                
  <section className='contentSection'>
    <h1 className='header'>Heading</h1>
    <div className='subHeader'>
       <h2 className='subheading'>Subheading</h2>
       <div className='logoContainer'>
          <img src={logo} alt='Logo'></img>
       </div>                        
     </div>
     <p className='textContent'>Lorem ipsum</p>
     <p className=‘textContent'>More lorem ipsum</p>
   </section>
    <section>
        … repeat of previous section
    </section>
</div>

CSS Styling:

@media only screen and (max-width: 719px) {

 .mainContent {
   display: flex;
   display:-webkit-flex; /* Safari */  
   flex-direction: column;
   justify-content: flex-start;
 }

.contentSection {    
    display: flex;
    display:-webkit-flex; /* Safari */  
    flex-direction: column;    
    height:0;
    width:100%;
    padding-bottom: 74.94%;/*https://example.com*/
    background-size: contain;
    background-repeat: no-repeat;
    background-image: url(./images/mobileImage.png)      
  }

.header{ 
    margin-top: 10%;
    padding-left:3%;
    font-size: 4vw;
    color:white;
    font-family: 'Gotham';
    font-weight: normal;
    word-wrap: break-word;
  }

}
.subheading{
    display:flex;
    display:-webkit-flex; /* Safari */
    flex-direction: row; 

  }

.logoContainer{
    display:flex;/*Flex required when images are used*/
    display:-webkit-flex; /* Safari */  
    flex-direction: column;
    width: 13%;
    height: 13%; 
     }

  .logoContainer img{
    width: 100%;
  }

.textContent {    
    padding-left:3%;
    padding-right: 3%;
    font-size: 3vw;
    color:white;
    font-family: 'Gotham';
    font-weight: normal;
    word-wrap: break-word;    

  }

}

@media only screen and (min-width: 720px){

 .mainContent {
   display: flex;
   display:-webkit-flex; /* Safari */  
   flex-direction: row;
   justify-content: flex-start;
 }

.contentSection {    
    display: flex;
    display:-webkit-flex; /* Safari */  
    flex-direction: column;    
    height:0;
    width:100%;
    padding-bottom: 74.94%;/*https://example.com*/
    background-size: contain;
    background-repeat: no-repeat;
    background-image: url(./images/desktopImage.png)      
  }

 .header{
      padding-left:9%;
      margin-top: 7%;
      font-size: 1.3vw;
      color:white;
      font-family: 'Gotham';
      font-weight: normal;
      word-wrap: break-word;
 }

.subheading{
    display:flex;
    display:-webkit-flex; /* Safari */
    flex-direction: row; 

  }

.logoContainer{
    display:flex;
    display:-webkit-flex; /* Safari */  
    flex-direction: column;
    width: 13%;
    height: 13%; 
     }

  .logoContainer img{
    width: 100%;
  }

.textContent {    
    padding-left:9%;
    padding-right: 9%;
    font-size: 0.7vw;
    color:white;
    font-family: 'Gotham';
    font-weight: normal;
    word-wrap: break-word;
  }
}

A handy technique from this source is being utilized to ensure that divs adjust their height based on background images.

While this design renders correctly in Chrome and Firefox, Safari on MacOS and iOS presents an issue where paragraph elements overlap with the titles and subtitles at the top of the section container. Despite trying different display properties and order attributes, the problem persists...

If you have any suggestions or solutions, they would be greatly appreciated!

Thank you!

Answer №1

Configuration

.section1 {
    height:auto;
  }

By eliminating padding-bottom, the issue was resolved.

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

What is the best way to showcase a blank div element using CSS?

Is there a way to make this empty div tag display without having to add &nbsp;? Can it be achieved using only CSS? <div class="bar bg-success" title="2015-07-23,5.0000" height="50%"></div> .bar { background: green; width: 5px; float ...

Filtering out specific properties in an array using Angular

I am facing an issue with my Angular filter when inputting text for a specific list. initialViewModel.users = [ {user: 'Nithin',phone: 'Azus', price: 13000}, {user: 'Saritha',phone: 'MotoG1',price: 12000}, {user: ...

Steps to display the leave site prompt during the beforeunload event once a function has finished running

While facing a challenge with executing synchronous Ajax methods in page dismissal events, I discovered that modern browsers no longer support this functionality in the "beforeunload" event. To work around this issue, I implemented a new promise that resol ...

An HTML table featuring rows and columns that can be adjusted in size separately from the content within each cell

Looking to create an HTML table where the columns and rows can be sized independently of the cell content? If a row or column isn't large enough to display all the content, it should simply overflow behind the cell. A solution was found that worked in ...

Styling Tip: Aligning text to the baseline of a height-adjusted input field using CSS

As per the information from the Mozilla documentation, it states that I can align the text in an input field to the baseline if the element's display property is set to inline-block. I have made adjustments to the height of several input elements, bu ...

Utilizing Typeahead for Autocomplete in Durandal: A Step-by-Step Guide

I am attempting to implement an autocomplete input field with typeahead (Twitter Bootstrap) in a modal, but I am encountering difficulties making it function properly. Additionally, this autocomplete field needs to be observable with Knockout so that selec ...

Retrieving a result from a function call is a fundamental aspect of programming

I have a scenario where I am initiating a call from a controller within AngularJS. This call passes some data to a service in order to receive a response that needs to be conditionally checked. Controller patents.forEach(function(item){ // The "patents" ...

What is the best way to perform a callback after a redirect in expressjs?

After using res.redirect('/pageOne') to redirect to a different page, I want to call a function. However, when I tried calling the function immediately after the redirect like this: res.redirect('/pageOne'); callBack(); I noticed th ...

The issue with grunt-contrib-compass not functioning properly within npm

I recently installed npm and grunt, followed by installing grunt-contrib-compass. However, when I try to run grunt, I encounter the following error: Running “compass:dist” (compass) task Warning: not found: compass Use –force to continue. Aborted du ...

Create a button that matches the dimensions of the background image

I am working with a form that includes a submit button featuring a background image. <button type="button" class="button" alt="Send" onclick="validate_form_newsletter_wide( form )"></button> Everything works well when I define the dimensions ...

Why is my console showing a SyntaxError with JSON.parse and an unexpected character?

I am facing an issue. When I attempt to call a PHP page for some data with specific requested parameters using AJAX asynchronous call, I encounter the following error: SyntaxError: JSON.parse: unexpected character var jsonData = $.ajax({ u ...

Adjusting the text color based on the dynamically set background color

If I have a calendar where each entry has a unique background color assigned to it (one color per user), including both light and dark colors that users can choose from, how can I set the text color to match the background style? Where should I begin wit ...

vue implementing autoscroll for long lists

I am looking to implement an autoscrolling log feature on my webpage that is dynamically fetched from a REST endpoint. To handle the potentially large size of this log, I decided to use vue-virtual-scroll-list. Additionally, I wanted the log to automatical ...

Is there a way to bypass cells within an html table?

Creating an online board game and looking to have the cells go around the board. Wondering if anyone knows a way to skip the cells in the middle? Attempted using   but it doesn't seem to be effective. Here is a snippet of the code: #board { ...

Angular error: Unable to access the 'toLowerCase' property of an undefined value

I've been working on creating my own custom filter pipe by following the instructions in this video tutorial, but I encountered an error message stating, "Angular, TypeError: Cannot read property 'toLowerCase' of undefined". I have already i ...

Invalidating the memory in iOS 7.1.1 when using canvas drawImage

When I use the following code on an animation frame, I notice a significant memory leak that eventually causes IOS Safari or Chrome to crash: ctx.drawImage(anotherCanvas, clipX, clipY, clipW, clipH, x, y, w, h); Interestingly, if I don't apply a ...

Mastering the art of managing promises within nested loops

Embarking on my Promise journey, I find myself faced with a scenario where a list of objects within another list of objects needs to be updated based on responses from an external API. I've attempted to simulate the scenario below. The code snippet f ...

Problems Arising with HTML Form Functionality

After creating an HTML form, I encountered an issue where upon submission, it prompts me to open G Mail or Outlook in order to send the email. Although the correct email address is populated, I wish for the email to be sent without having to open any ext ...

Modify data in an array using Vuex

When working with my Vuex mutation, I am trying to replace an element in an array within the state. The code snippet below illustrates what I am attempting to do: UPDATE_MAILING(state, mailing) { let index = _.findIndex(state.mailings, {id: mailing.id ...

utilizing the .on method for dynamically inserted elements

I have a code snippet that triggers an AJAX request to another script and adds new <li> elements every time the "more" button is clicked. The code I am using is as follows: $(function(){ $('.more').on("click",function(){ var ID = $(th ...