Issues with flexbox in Safari

I've encountered an issue with some divs specifically in Safari, as other browsers seem to function correctly. Occasionally, these rectangles will appear and disrupt the layout, causing overlaps with images. Interestingly, this problem seems to only occur when the project is deployed, not on my local server.

Note the background color bleeding over the images

Interestingly, I have found that the issue resolves itself in the following ways:

  1. Resizing/zooming the page
  2. Opening the web inspector (without performing any actions)
  3. Refreshing the page—occasionally

This is what the HTML looks like for the three divs (.ldb-part) and their parent div (.ldb):

HTML:

        <div class="ldb">
        <div class="ldb-part">
            <h3>Landscape</h3>
            <img src="/Image1.jpg" alt="">
            <p>Lorem ipsum dolor sit amet, consectetur...</p>
        </div>
        <div class="ldb-part">
            <h3>Design</h3>
            <img src="/Image2.jpg" alt="">
            <p>Lorem ipsum dolor sit amet, consectetur...</p>
        </div>
        <div class="ldb-part">
            <h3>Build</h3>
            <img src="/Image3.jpg" alt="">
            <p>Lorem ipsum dolor sit amet, consectetur...</p>
        </div>
        </div>

CSS:

.ldb {
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;

    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-align-items: center;
    align-items: center;

    justify-content: center;

    position: absolute;
    top: 93%;
    max-width: 70vw;
    height: 20em;
    padding-bottom: 4em;
}

.ldb-part {
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;

    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-align-items: center;
    align-items: center;

    justify-content: space-around;

    flex-direction: column;

    text-align: center;

    width: 30%;
    height: inherit;
    margin: 0 1em;
    padding: .5em;
    border: 1px solid #BDBDBD;
    border-radius: 10px;
    background: #FFFDF8;
}

Answer №1

I came across a workaround for a different problem that appears to temporarily solve my current issue.

Fingers crossed it doesn't resurface...

Answer №2

In my recent findings, I have observed that even though Safari, which is a browser with a Webkit engine, asserts its compatibility with display: flex, the support seems to be incomplete as it occasionally causes child elements to overlap each other. Interestingly, the old specification display: -webkit-box appears to function correctly in this scenario.

Answer №3

From my personal experience, I have found that flexbox does not function properly in Safari. However, when I replaced it with grid display, the issue was resolved.

It seems that using grid display could be a solution to this problem.

.ldb-part {
    display: grid;
    grid-template-rows: auto auto;

    align-items: center;
    justify-content: space-around;

    text-align: center;

    width: 30%;
    height: inherit;
    margin: 0 1em;
    padding: .5em;
    border: 1px solid #BDBDBD;
    border-radius: 10px;
    background: #FFFDF8;
}

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

Changing the color of Bootstrap Carousel Indicators for a single slide

I am currently facing an issue with the default bootstrap carousel. One of my slides has a white background, causing the carousel indicators to disappear on that specific slide. Although I have a Javascript/jQuery solution in place, it appears to be slig ...

I'm encountering an issue with my CSS image slider as it does not seem to be functioning properly on Google Chrome, yet

CSS: @-moz-keyframes slidy { 0% { left: 0%; } 20% { left: 0%; } 25% { left: -100%; } 45% { left: -100%; } 50% { left: -200%; } 70% { left: -200%; } 75% { left: -300%; } 90% { left: -300%; } 95% { left: -400%; } 10 ...

Adjusting the rover effect in HTML can alter the size of an image

I'm trying to create a rollover effect in HTML with the following code: <img src="images/facebook.png" onmouseover='this.src="images/facebookActive.png"' onmouseout='this.src="image/facebook.png"' height="32px" width="32px"/&g ...

Resizing a div dynamically based on its parent's position using JavaScript

I've been working on a code to dynamically resize multiple divs. The original code only resized one element, but I modified it to handle multiple div resizers. However, I'm facing an issue where there is a gap between the mouse and the div while ...

Is it possible to conceal specific sections of a timeline depending on the current slide in view?

For my product tour, I've structured a timeline with 4 main sections, each containing 4-5 subsections. Here's how it looks: <ul class="slideshow-timeline"> <li class="active-target-main main-section"><a href="#target">Targe ...

Problem with CSS in the Internet Explorer 8 browser encountered

While working on a project, I encountered an unexpected design issue on a client's machine that has Internet Explorer 8 installed. Interestingly enough, when testing on my own machine with IE 9 and using F12 to switch to compatibility mode for IE 8/7, ...

The grid system functions flawlessly on desktop computers, but unfortunately, it fails to display correctly on mobile devices. Instead of adapting to the smaller screen size, it

I'm having an issue with my grid system. It works perfectly on PC, but not on mobile. On mobile, it shows the same view as on PC. Can anyone help me figure out what is wrong in this code? <div class="row"> <div class="col-md-3 col- ...

The ideal choice for a default background image in terms of style and dimensions

I'm using this code to set a background image for my website. body{ background: url('path_to_image'); background-size: 100%; } I find that the background-size property works well for handling different screen sizes. I'm creating ...

The Twitter Bootstrap 3 navbar on the right side, positioned outside the collapsible navbar

When using Twitter bootstrap 2.3.2, I could implement the following code snippet: http://jsfiddle.net/aQwUZ/3/ <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> ...

Setting a timer within Vuex - step by step guide

I recently delved into learning Vue and Vuex. My current project involves setting up a countdown timer that initiates a countdown from 5 seconds upon being clicked. The implementation logic resides in the Vuex store for efficient state management, but unfo ...

Present a two-column layout using row formatting in Bootstrap with Angular

In my component file, I have an arrayData containing 4 datas, and I am trying to display them in two columns across two rows. <div class="row"> <div class="col-md-6" *ngFor="let cat of myArrayData; let index=index"> <div clas ...

Cross-domain scripting with JavaScript

I currently manage 2 subdomains securityservices.example.com workstations.example.com All workstations are associated with the workstations.example.com One of the workstations, known as WS789012 on the domain, is fully qualified as: WS789012.workst ...

Leveraging SASS for injecting a variable into a mixin where the declaration is in string format

I have been developing a SASS mixin that allows for the input of various variables to construct a font-awesome declaration in the following format: @mixin after-font-awesome($unicode, $size, $margin, $color, $weight) { &:after { content:$unicode ...

What is the best way to update the content of a div when it is being hovered over?

On my website I am building, there is a division that contains text. When I hover over the division, I want the text to change from "example" to "whatever". I came across a forum discussing this, but I'm having trouble understanding it. Can someone p ...

What causes the unexpected behavior of MatPaginator within an ngIf statement?

CHECK OUT MY STACKBLITZ DEMO Here's the material table setup I'm working with: <table mat-table [dataSource]="dataSource" > ... Rows ... <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-row * ...

Obtain textNames and colorNames data from a locally stored nested JSON file

I am currently working with a data.json file to fetch and display data in my HTML. Here is the code snippet of my Component: tooltip: any; tooltipColor: any; ngOnInit() { this.DataFactory.getLimitedData(this.widgetData).subscribe(data => { this ...

What is the process for adjusting the color of the browser tab?

My chat application is running smoothly, but a client has requested the ability to highlight or make the browser tab blink when they receive a visitor call. This will help them respond promptly to incoming inquiries. Does anyone know how to implement thi ...

Using explode() in PHP to read a text file and extract desired sections of text

I am faced with a challenge involving two text files - users.txt and schedule.txt. The content of the schedule.txt file is structured as follows: 0 1 2 2013-04-11^12:00|4:00|14:00 3 4 5 6 2013-07-21^10:00|15:00|18: ...

Leveraging XSL for presenting KML data within an interactive HTML table

It has been a while since I last delved into coding, so I appreciate your patience... I have an application that generates the following non-standard kml file: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> ...

Receive the height from the parent element using the box-sizing property set to border-box

Let's talk about a CSS challenge. .parent{box-sizing: border-box; height: 60px; border: 1px solid green;} The child div has its own styling: .child{height:inherit;background: red} Here is the code snippet: ...