开发者

iOS safari: (-webkit-)box-shadow on input:focus doesn't work

开发者 https://www.devze.com 2023-04-10 05:15 出处:网络
Safari has some strange behavior towards box-shadow. i开发者_开发百科nput[type=\"text\"]{ -webkit-box-shadow: 0 0 8px #000000;

Safari has some strange behavior towards box-shadow.

i开发者_开发百科nput[type="text"]{
    -webkit-box-shadow: 0 0 8px #000000;
    box-shadow: 0 0 8px #000000;
}
input[type="text"]:focus{
    outline: none;
    -webkit-box-shadow: 0 0 8px #ffffff;
    box-shadow: 0 0 8px #ffffff;
}

The box-shadow is displayed but as soon as the element gets focus the shadow vanishes completely. Same effect happens if you don't set anything in :focus.

It does work on Desktop-Safari. I'm using iOS 5 beta (iPad), I can't test it on a stable release or other devices.

Does anyone has a solution to this?


Use -webkit-appearance: none to override the native look:

input[type="text"]{
    -webkit-appearance: none;
    -webkit-box-shadow: 0 0 8px #000000;
    box-shadow: 0 0 8px #000000;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号