CSS Element Overlapping Issue in Safari Browser

I am currently developing an audio player for my application that includes a pause/play button, next button, and back button. I have encountered a problem specifically on Safari where the back/pause buttons are overlapping each other. The play/pause button changes based on the current play state. Interestingly, this issue only occurs on Safari while Chrome, Firefox, and IE work fine without any overlap. Can someone provide assistance with this? It seems like the styles associated with pause and play are conflicting with the styles of the back_container.

  const [play, setPlay] = useState(false)

            <div className = {styles.play_container}>
            <div className={play ? styles.pause : styles.play} onClick={handlePlay}></div>
                <div className = {styles.next_container} onClick={()=>handleNext()}>
                    <div className={styles.skip1}></div>
                    <div className={styles.skip2}></div>
                </div>
                <div className = {styles.back_container} onClick={()=>handleBack()}>
                    <div className={styles.back1}></div>
                    <div className={styles.back2}></div>
                </div>
            </div>

.play_container{
    display: flex;
    top: 40%;  
    position: absolute;
    z-index: 2000;
    height: 2%;
    width: 68%;
    /* left: 70px; */
    justify-content: center;
}
.pause{
    z-index: 2100;
    height: 20px;
    border-style: double;
    border-width: 0px 0px 0px 19px;
    border-color: #202020;
    visibility: visible;
    cursor: pointer;
}

.play{
    z-index: 2100;
    border-style: solid;
    height: 20px;
    border-width: 10px 0px 10px 15px;
    border-color: transparent transparent transparent #202020;
    box-sizing: border-box;
    visibility: visible;
    cursor: pointer;
}
.next_container{
    display: flex;
    position: absolute;
    z-index: 2100;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: 100px;
    justify-content: center;
}

.back_container{
    display: flex;
    position: absolute;
    z-index: 2100;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 100px;
    justify-content: center;
}
.skip1{
    z-index: 2100;
    width: 20px;
    height: 5px;
    border-style: solid;
    border-width: 7px 0px 7px 7px;
    border-color: transparent transparent transparent #202020;
    box-sizing: border-box;
    visibility: visible;
    margin-top: 3px;
}

.skip2{
    z-index: 2100;
    height: 14px;
    border-left: 2.5px solid #202020;
    visibility: visible;
    margin-right: 10px;
    margin-top: 3px;
}

.back1{
    z-index: 2100;
    height: 14px;
    border-left: 2.5px solid #202020;
    visibility: visible;
    margin-left: 10px;
    margin-top: 3px;
}
.back2{
    z-index: 2100;
    width: 20px;
    height: 5px;
    border-style: solid;
    border-width: 7px 7px 7px 0px;
    border-color: transparent #202020 transparent transparent;
    box-sizing: border-box;
    visibility: visible;
    margin-top: 3px;

}

Answer №1

Here's an interesting solution I discovered for positioning the back container:

.back_container{
display: flex;
position: absolute;
z-index: 2100;
width: 20px;
height: 20px;
cursor: pointer;
margin-right: 100px;
justify-content: center;
left: 50%;
transform: translateX(-100px);
}

By specifying a left value and using a transform, I was able to center the back button on top of the play button while also moving it back by 100px. While I would typically use flexbox or grid to align controls, this code provides a quick fix.

Answer №2

It's important to note that not all CSS styles will function across all web browsers.

This is a key piece of information If you're encountering issues with styling in Safari.

You can create a style that targets only Safari browsers without affecting others, addressing the problem.

To target Safari specifically with your styles, enclose them within

@media screen and (-webkit-min-device-pixel-ratio:0) {
  //add your customized Safari styles here
}

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

ChartJS is exhibiting an issue within a modal or popup window where the chart is being displayed with a height

I want to show a graph in a modal window when the user clicks a button. The modal is hidden with display: none;, and becomes visible with display: flex; once the button is clicked. If I move the chart outside of the modal, it works without any issues. Ad ...

Creating a loop to iterate through JSON data being received

I successfully used JSON to display data, but I am now wondering how I can print all the database entries into a div or table. JavaScript $(document).ready(function() { $.ajax({ type : 'POST', url : 'server.php', dataTyp ...

Is the nodejs pm2 server consuming excessive resources?

When I request a website in my browser, the server specifications are 2GB RAM and dual core Ubuntu based. I have hosted the website using pm2, but it seems like the node.js app is not performing well. Have you tried restarting or reinstalling it? I have ...

encountering an issue: file or directory does not exist, unable to open 'rds-combined-ca-bundle.pem'

I recently downloaded AWS secure socket for my Node server and integrated it into my index.js folder. However, I encountered an error that reads: "Error: ENOENT: no such file or directory, open 'rds-combined-ca-bundle.pem'. Could someone help me ...

What is the best way to display HTML content from a stored object?

In my project using Next.js, I am faced with the challenge of rendering custom landing pages based on their unique URLs. While I have successfully retrieved all the necessary details from the database for each specific URL, there is a particular object con ...

Performing synchronized execution in a node.js application by utilizing the 'readline' package

Struggling with the asynchronous nature of node.js, despite hours spent on callbacks and researching. I have a program that reads lines from a file using the readline module in node, passing data to async functions within the program. The goal is to proces ...

Reacts Router Link does not refresh page content

My React and Redux application features a Movie component that displays movie data fetched from an API. To enhance user experience, I decided to create a Similar Movies section at the bottom of the page. This section contains components that allow users t ...

The implementation of Ajax beforeSend and complete functions is not possible at the moment

I’ve been attempting to implement a spinner image while loading ajax data, but I can't seem to get it to work. Here's my code : $.ajax({ url: '/Observer/GetInfoProfileByProfileId', type: 'POST', data: { ProfileId: ...

Obscured painting surface appearance using Three.js

I am attempting to incorporate a blurred texture into my Three.js scene, but the results are not what I expected. Canvas: var c = document.getElementById("myCanvas"); var context1 = c.getContext("2d"); context1.filter = "blur(16px)"; context1.beginPath( ...

Generate unique identifiers to rotate images dynamically on the webpage

My goal is to rotate every image on a page, and while this works with a single image, it only rotates the first one since each ID needs to be unique. I need to find a way to dynamically increment the IDs as they are encountered on the page. Below is what I ...

The process of utilizing the override feature in the package.json file to make updates to child dependencies

There seems to be a vulnerability in the async package that I want to update to version 3.2.2. Here is the dependency tree if I use npm list async: └─┬ [email protected] └─┬ [email protected] └── [email protected] After referring t ...

Ways to collaborate on code among multiple projects

What is the most efficient way to share code between a React and Node.js application, both using vanilla JavaScript? Consider this snippet: function slugify(str) { return str.replace(/[^a-z0-9)(\.\-_\s]/gi, ""); } How can I implement t ...

Select a checkbox automatically after receiving an ajax response

I am currently working with a form that contains multiple checkboxes like the one below: <label class="checkbox"> <input type="checkbox" id="user_ids_for_edit" name="user_ids_for_edit[]" data-toggle="checkbox" data-toggle="checkbox" value="14"&g ...

Use either lodash or a for loop to organize a group of JSON objects

Here is the array I am working with: [ { corequisite: "", curriculumYr: "2017-2018", programCode: "ET" majorCode: "AET", prerequisites: "GMRC 101||Math 101" semester: "1st Term", year: "1st Year", subjectCode : "ENG ...

Ways to customize the appearance of the Next/Prev Button in Griddle

Here is the scenario that has been implemented: nextClassName={'text-hide'} nextText={''} nextIconComponent={ <RaisedButton label='Next' />} As a result, a Next Button with a wrapper div above the but ...

Enhancing Online Presence with Video Gallery Website Development

I'm in the process of creating a website and need help finalizing my video page. I envision a layout similar to this example: https://i.stack.imgur.com/hctui.gif The main feature should be a large video placeholder at the top, followed by several thu ...

A guide on integrating MongoDB, Mongoose, Express JS, and Node JS for effectively adding prices

Currently adding various documents to the database: await TestMOdel.insertMany([ { Model: "Samsung", price: 45000, OS: "MS DOS", }, { Model: "Wipro", pr ...

Using Jquery to input selected dropdown values into a text input field

Currently, I am facing some challenges in achieving this task. My goal is to have the selected option from a dropdown list called programs_dropdown added to a text field named programs_input, with the option values separated by commas. For example: php, j ...

What is the method to modify the color of the final letter within an element?

Is it possible to make the last letter of a word appear red using CSS? <asp:Label ID="QuestionText" runat="server" CssClass="asterisk"></asp:Label> .asterisk:after { color: Red; content: " *"; } The challenge arises from the fact tha ...

Tips for preventing the loss of ajax calls when an Oauth access-token expires

As the creator of a JavaScript browser application (SPA) that communicates with a server protected by OAuth 2, I encounter the challenge of using short-lived access tokens and longer-lived refresh tokens. While this specific scenario involves my own server ...