Is there a way to circumvent the box-shadow glitch in Mobile Safari?

LATEST UPDATE: Box shadows are displaying correctly on iPhone using Mobile Safari for iOS 7, but there seems to be an issue with iPad using the same browser. Chrome for iOS 7 is also affected by this problem when used on an iPad.

UPDATE 2: To see a video demonstration of the problem, click here: youtube.com/watch?v=eTewrM5vIaQ.

The CSS/HTML code below (provided in JSBin here) creates a 3D box that works well in Safari 7 for desktop, Firefox, and Chrome:

<!DOCTYPE html>
<html>
<head>
  <title>Title</title>

  <style type="text/css">
    body {
        text-align: center;
        margin-top: 100px;
    }

    .coming-back {          
        display: inline-block;          

        padding: 100px;

        background-color: rgb(31, 219, 153);
        -webkit-box-shadow: 
            15px 15px 0 0 #2d9a74,
            14px 14px 0 0 #2d9a74,
            13px 13px 0 0 #2d9a74,
            ...
            1px 1px 0 0 #2d9a74;
      -moz-box-shadow: 
            ...
            1px 1px 0 0 #2d9a74;
      box-shadow: 
            ...
            1px 1px 0 0 #2d9a74;

        color: #fff;
        font-family: "rooney-sans",sans-serif;
        font-style: italic;
        font-size: 96px;        
    }

    @media screen and (min-width: 768px) and (max-width: 1024px) {
            body {
                margin-top: 50px;
            }       

            .coming-back {
                padding: 50px;
                font-size: 64px;
            }
    }

    @media screen and (max-width: 767px) {
            body {
                margin-top: 50px;
            }       

            .coming-back {
                padding: 50px;
                font-size: 64px;
            }
    }
  </style>
</head>
<body>
    <div class="coming-back">
        Coming back soon!
    </div>  
</body>
</html>

Here's another example:

However, the borders are not visible at all in Mobile Safari 7 on iOS 7.

Is this a known bug? Any suggestions for fixing this issue? Or could it be something I'm overlooking?

Answer №1

After reporting this problem to both WebKit's bug tracker and Apple, it has been verified that this is a known issue and Apple is working on resolving it. Hopefully, the next update for iOS 7 will include a fix for this bug.

Answer №2

It appears that the issue is closely tied to the use of multiple shadows. While I may not be able to explain why, it doesn't come across as strange, considering the various bugs encountered on Mobile Safari in the past :)

To address this, my suggestion is to utilize a single shadow and leverage :before and :after pseudo elements to incorporate triangle corners that will give your shape a 3D appearance.

.coming-back {
  position: relative;
  box-shadow: 16px 16px #2d9a74;

  /* other styles... */
}    

.coming-back:before,
.coming-back:after {
  content: "";
  display: block;
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;      /* border width is 1/2 shadow offset */
}

.coming-back:before {
  top: 0;
  left: 100%;
  border-left-color: #2d9a74;
  border-bottom-color: #2d9a74;
}

.coming-back:after {
  top: 100%;
  left: 0;
  border-top-color: #2d9a74;
  border-right-color: #2d9a74;
}

DEMO: http://jsbin.com/UhelOfic/2

An important point to remember is that this method works best when the shadow offset is an even number (I adjusted it to 16px).

Answer №3

I faced a similar issue and was able to resolve it by setting the border radius specifically for iPad.

border-radius:1px

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

The use of jQuery addClass does not produce any changes

I am trying to modify a single attribute in my class using a JavaScript function. .msg_archivedropdown:before { content:""; display: block; position:absolute; width:0; height:0; left:-7px; top:0px; border-top: 10px solid tr ...

Misconception about the usage of jQuery's .each() function clarified with an illustrative example

Problem Description (See Fiddle): When clicking on the red boxes, they transform into kittens and display an alert with the current value of i. Clicking on a large fading kitten will reset everything. I am puzzled as to why alert(i) is triggering multipl ...

Creating an endless variety of modals using HTML - The ultimate guide

Currently, I am in the process of developing a Project Manager website by utilizing w3school's To-do-list tutorial. To enhance the functionality, I have included a detail button (denoted by ...) that triggers a modal displaying task information. Howev ...

What is the best way to ensure these elements are neatly stacked one on top of the other?

Is there a way to center this text div while keeping it behind a fading image on the page? I've tried using margin-left: auto; and margin-right: auto; but it doesn't seem to work. Am I missing something? I'm testing everything in Chrome, ju ...

Is there a method in Bootstrap 4 to create a table row that can be clicked on?

Is there a way to make the rows in a table clickable when using the 'table-hover' class in B4? <table class="table table-hover"> <thead> <tr> <th>#</th> <th>First Name</th> <th ...

What is the process for setting up a vertical carousel in Bootstrap 5 with a stationary previous image?

Looking for assistance with my vertical carousel project. Is there a way to create a vertical carousel in bootstrap 5 with the previous image fixed? I found a slider on this website: zara.com/jp/en/ I want to maintain the previous image in a fixed posit ...

Interactive Vue.js canvases that adapt and respond to various

I am currently working on adjusting my canvas to fit within its container in a Vue component. When I call resizeCanvas() in the mounted hook, I notice that the container's height and width are both 0. How can I create a canvas that dynamically fits it ...

Alignment slightly off when trying to vertically center inline elements

I'm struggling with aligning an icon (<img>) vertically next to some text. The icon always appears slightly lower than the text, as shown in the example below. Can someone please suggest a solution to center it vertically with the text? Example: ...

Problem with NextJS: CSS styles not being applied globally to elements

Recently, I created a blog using nextJS and loaded markdown files as posts on the main page. To style my website, I used css modules along with a global.css file. However, I've encountered an issue where some properties from the global.css file are no ...

Different Ways to Make Custom Checkboxes Overlap with Labels in CSS

Hello everyone, I am currently diving into the world of CSS and HTML. My goal right now is to create a custom checkbox with a list of options. During my research, I stumbled upon an example on how to create custom checkboxes at this link. However, when imp ...

Will the fonts on my website display correctly if I incorporate Google Web Fonts?

Have you checked out this amazing font selection: https://www.google.com/fonts I'm interested in using unique fonts on my website. If I incorporate Google Web Fonts into my site, will the fonts show up correctly? Will the user's browser default ...

Is it possible to create a carousel using PHP and MySQL?

Is it really impossible? I'm determined to pull images from a MySQL database and create a carousel similar to the one showcased in this link: . However, my goal is to achieve this using only HTML, CSS, PHP, and MySQL. ...

The list is shifting unexpectedly as the font size transitions

Hey guys, I've created a cool interactive design with six boxes that increase in font size when hovered over. However, this causes the boxes to move around, as you can see in my example. Any suggestions on how to fix this issue? Another thing I notic ...

"Positioning a div around a Bootstrap form-inline: A step-by-step guide

When using Bootstrap 3 "form-inline" within a <div>, I noticed that the div seems to be nested within the form-inline. This is how my code looks: HTML <div class="wrapper"> <div class="form-inline"> <div ...

Expanding the content within the modal body in Twitter-Bootstraps does not increase its size

Here's the code snippet that I'm working with: <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-conte ...

Tips for aligning the image and text in the center of the page

Struggling to center this image on my website. I've attempted various methods like margin: 0 and absolute positions, but nothing seems to work. Being a beginner in html and css doesn't help either. My attempts to center it have been futile. The ...

Overflow of dropdown menus in HTML CSS

Hello, I am new to both html and stack overflow. Please forgive me if this question has already been asked, as I couldn't find anything (but maybe I didn't search enough?). I have tried using overflow and clear properties, but I am struggling to ...

Enhance Bootstrap modals by automatically adjusting the background shadow mask when resizing or changing the content within the modal window

Incorporated within my bootstrap modal window is a form alongside a link that triggers the jQuery functionality of .slideToggle(). By interacting with this link, a concealed div expands. Consequently, the size of the modal popover becomes fluid. Upon click ...

How can one use Selenium's XPath or CSS selectors to retrieve an element based on the text of its inner element or the text of the current element?

Exploring the code below: <section id="section2" class="MightChange1 MightChange2"> <div id="dynamicIdxxx" class="dynamic1 dynamic2 dynamic3"> <div id="againDynamic" ..> <div id="someDynamicCanBeRelayed" class="xyz"&g ...

The Bootstrap collapsible menu isn't expanding all the way when clicked

I've hit a roadblock with a small issue that I can't seem to resolve. As a newcomer to bootstrap, I was working on programming the header with navigation when I encountered a problem that has me stumped. I'm reaching out for some assistance ...