当前位置: 首页 > Web前端 > CSS

移动端开发兼容性问题

时间:2023-03-31 12:35:47 CSS

1、Android使用绝对定位布局与原生输入冲突。如果绝对定位元素在底部,弹出键盘时,绝对定位元素会在键盘上。resize事件,隐藏元素exportfunctionadapterPosition(selector){if(/iphone/i.test(navigator.userAgent))returnconsth=window.innerHeight;constdom=document.querySelector(selector)if(!dom)returnconstdisplay=dom.style.displaywindow.addEventListener('resize',()=>{constheight=window.innerHeightif(heightVerificationcode

发送验证码
.item{margin-left:15px;框大小:边框框;高度:60px;填充:12px15px12px0;溢出:隐藏;背景色:#fff;颜色:#212121;位置:相对;显示:-webkit-box;:中心;border-bottom:1pxsolid#f4f4f4;font-size:16px;}.item.name{margin-right:10px;最小宽度:48px;}.item.input{显示:块;//需要添加一个display:blockoutline:0none;-webkit-box-flex:1;弹性:1;字体大小:16px;填充:0;边框宽度:0;盒子阴影:无;-webkit-用户选择:文本;-moz-用户选择:文本;-ms-用户选择:文本;user-select:text;}3.relativetop失效relative元素的top属性失效的原因是父元素没有设置高度,子元素top使用百分比时没有引用,以及这时候就可以使用px值了。4、滚动穿透问题描述:有些场景需要遮罩,但是背景还是可以滚动的,即滚动穿透。解决方法如下,主要是获取页面的滚动元素,并设置为fixedbody.no-scroll{position:fixed;宽度:100%;}UtilFn.ModalHelper=function(bodyCls){varscrollTop;varscrollingElement=document.scrollingElement||文件主体;//这种写法兼容webkit,获取页面滚动元素return{afterOpen:function(){scrollTop=scrollingElement.scrollTop;文档.body.classList.add(bodyCls);document.body.style.top=-scrollTop+'px';},beforeClose:function(){document.body.classList.remove(bodyCls);scrollingElement.scrollTop=scrollTop;}};}5。参考http://web.jobbole.com/84113/浏览器对小数点四舍五入四舍五入,实际渲染是四舍五入后,但真正占用的空间是原来的大小,四舍五入后的值会影响下一个