iPad/iPhone 上的 CSS 提交按钮奇怪的渲染
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5438567/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS submit button weird rendering on iPad/iPhone
提问by Francesco
I noticed that if I style my buttons with CSS using radius, colors and borders, they look good but in the iphone/ipad/ipod they look terrible...shouldn't be the same rendering as in Safari Desktop??
我注意到,如果我使用 CSS 使用半径、颜色和边框设置按钮样式,它们看起来不错,但在 iphone/ipad/ipod 中它们看起来很糟糕……不应该与 Safari Desktop 中的渲染相同吗??
回答by Francesco
oops! just found myself: just add this line on any element you need
哎呀!刚刚发现自己:只需在您需要的任何元素上添加此行
-webkit-appearance: none;
回答by subindas pm
Add this code into the css file:
将此代码添加到 css 文件中:
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
This will help.
这会有所帮助。
回答by Priyank Thakkar
The above answer for webkit appearance did the magic, but the button still looked kind pale/dull compared to the browser on other devices/desktop. I also had to set opacity to full (ranges from 0 to 1)
上面对 webkit 外观的回答很神奇,但与其他设备/桌面上的浏览器相比,该按钮看起来仍然苍白/暗淡。我还必须将不透明度设置为完全(范围从 0 到 1)
-webkit-appearance:none;
opactiy: 1
After setting the opacity, the button looked the same on all the different devices/emulator/desktop.
设置不透明度后,按钮在所有不同的设备/模拟器/桌面上看起来都一样。