web移动端之ios兼容问题

  网站打包放在ios的app上会自动一瞬间给网站某些标签加上其他标签和属性。导致该标签内容异常

 

1:ios中点击出现灰色阴影效果,(明明什么效果都没有加)
解决办法:

-webkit-tap-highlight-color: transparent;
 
2:xxxx-xx-xx 日期格式在ios中报错
解决办法:改成xxxx/xx/xx格式。例如:

new Date(this.fullyear + '/' + this.month + '/1').getDay()
 
3:ios将日期识别为电话号码导致的变色问题

原因:这几个日期被ios自动加了a标签这段代码

<a dir="ltr" href="tel:2930311" x-apple-data-detectors="true" x-apple-data-detectors-type="telephone" x-apple-data-detectors-result="0">29</a>
 
解决办法:
在样式表中加入

*[x-apple-data-detectors] {
border-bottom: 0 !important;
cursor: default !important;
color: inherit !important;
text-decoration: none !important;

参考链接:
点击查看ios将电话号码设置为蓝色的解决办法

4:去掉ios中input框有默认阴影框
解决办法:

input {
outline-color: invert;
outline-style: none;
outline-width: 0px;
border: none;
border-style: none;
text-shadow: none;
-webkit-appearance: none;
-webkit-user-select: text;
outline-color: transparent;
box-shadow: none;
}
 
5:ios中字体会显示加粗效果,但是在android上显示ok
解决办法:进行抗锯齿渲染。
这个属性可以使页面上的字体抗锯齿,使用后字体看起来会更清晰。

-webkit-font-smoothing: antialiased; /*chrome、safari*/
-moz-osx-font-smoothing: grayscale;/*firefox*/
 
解释:

(1)Webkit在自己的引擎中支持了这一效果。
-webkit-font-smoothing
它有三个属性值:
none ------ 对低像素的文本比较好
subpixel-antialiased------默认值
antialiased ------抗锯齿很好
例子:
body{-webkit-font-smoothing: antialiased;} 
 
(2)Gecko也推出了自己的抗锯齿效果的非标定义。
-moz-osx-font-smoothing: inherit | grayscale;
这个属性也是更清晰的作用。
例子:
.icon {-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
 

posted @ 2018-11-20 10:54  牛奶欲咖啡  阅读(1799)  评论(0编辑  收藏  举报