iPhone iOS will not display box-shadow properly

后端 未结 2 1620
自闭症患者
自闭症患者 2020-12-08 00:10

The Design

The contact form on a responsive design has input fields with both an inset shadow and regular outside shadow. See image below.

相关标签:
2条回答
  • 2020-12-08 00:32

    Try adding -webkit-appearance: none; iOS tends to mess up forms.

    0 讨论(0)
  • 2020-12-08 00:44

    I had a problem trying to add a box-shadow around invalid inputs (before submit is clicked).

    Using -webkit-appearance: none; worked fine for a while, but I've noticed on chrome checkboxes have gone missing now.

    Here's my hack that works more or less cross browser. Looks like safari is the new "internet explorer" :-/

    input:invalid, select:invalid, textarea:invalid, .invalid {
        background-clip: padding-box; /* Safari fix */
        box-shadow: 0 0 5pt 2pt rgba(255,0,0,.75) !important;
    }
    
    select:invalid {
        border: 1px solid red; /* Safari fix */
    }
    
    input[type="checkbox"]:invalid{
        background: red; /* Safari fix */
    }
    
    input[type="radio"]:invalid{
        background: red; /* Safari fix */
    }
    

    0 讨论(0)
提交回复
热议问题