火狐position定位时用到margin-top:50%出错
来源:互联网 发布:htc x9网络 编辑:程序博客网 时间:2024/05/22 06:45
今天在做弹层时发现fixed在火狐上不能正确居中,后发现不是positon的问题而是,margin-top的%算发不一样。并且
transform-style: preserve-3d;使position:fixed属性失效(3d变形后就会出现fixed的高度出现问题)
DEMO
<div style="position:relative;margin: 0 auto;width: 500px;position:relative;background: red;height: 2000px;"> <div style="position: fixed;height: 100%;width:100%;background: blue;"> <div style="position: fixed;background: black;width: 500px;height: 200px;margin-left: 50%;margin-top: 50%;"> </div> </div></div>
最后用js计算高度实现了或者去除transform-style解决了
0 0
- 火狐position定位时用到margin-top:50%出错
- 火狐下不支持position:relative;top:50%;?
- CSS定位时margin-top与margin-bottom
- margin-top、top、以及position的总结
- ie与火狐一个差异:margin-top
- css div margin-top 无法定位
- 解决CSS margin-top在火狐下失效问题
- 定位参数:position、left、right、top、bottom
- relative定位下要使用top、left,而不是margin-top、margin-left
- 元素的position:absolute;属性和margin-left:480px; margin-top:-20px配合使用
- 元素position设置为fixed而未指定top、bottom、left、right时的定位
- position定位不设置left top 等值,以及position定位的百分比取值
- margin-top时,层内元素并没有margin,而是父层出现了margin-top
- position:absolute 时 margin-bottom 不起作用
- padding-top margin-top top
- 火狐FF和IE兼容下margin-top无效的解决方法
- css中的四种定位以及top和margin-top的区别
- IE6下position:absolute相邻元素margin-top失效的bug
- VirtualBox 中 centos7 下 ping 命令出现 Network is unreachable 问题的解决方法
- 量化函数IBoll-布林带的策略实用
- [sentry源码阅读] event请求与写入过程初步剖析
- Appium-Android元素定位方式
- 洛谷 模板 树状数组
- 火狐position定位时用到margin-top:50%出错
- fastjson下对象转json时丢失属性的问题
- Spring Boot 入门笔记
- android Touch事件三个方法
- TIANKENG’s restaurant
- SpringMVC 4.x输出JSON数据配置
- react native项目编译出错:解决之道
- spark性能调优五
- 记一次git amend事故处理方案