Comments (14)
华为 C8818的默认浏览器
from rem.
ios下调整微信字体大小,页面样式有变化,但是获得的html的默认字体大小仍是16px,不知道有没有遇到这个问题
from rem.
ios设备,以及微信里面都不会随系统字体大小改变html的默认字体大小,主要是一些Android的默认浏览器和这些Android设备的客户端的webview里面有。
from rem.
那ios仍然会存在问题,这个没办法解决是么,还有一个刚刚在华为p6上展示最终方案时,出现设置前1rem的宽度:undefined的情况,目前没有在其他手机上出现过这个问题
from rem.
华为p6上的问题可能是 d.remove() 这个bug导致的,已经修改。ios不清楚你说的是什么问题。
from rem.
undefined的问题解决,但是h.style.fontSize为""导致6.4rem的计算值为NaN
from rem.
还是只有华为p6出现这个问题..
from rem.
h.style.fontSize是因为使用了css设置html标签的font-size,所以获取不到,不影响使用。去掉document.documentElement.style.fontSize 这行的注释即可(于css设置有冲突所以实际使用中要注释掉)。
from rem.
华为p6调整浏览器字体大小后4.1的偏差比4.2小...(不好意思,最近总打扰..),4.2显示为:
设置前html的font-size:26px
设置前1rem的宽度:25
html fontSize的设置值为:225%
设置后的fontSize:58px
from rem.
不打扰,交流才能有获得,
4.1的方案中使用的是getPropertyValue('font-size'),这个值浏览器会四舍五入为整数,其实是不精确的。
var htmlFontSize = parseFloat(window.getComputedStyle(h, null).getPropertyValue('font-size'));
document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px / htmlFontSize * 100 + '%';
4.2的方案中使用的是计算一个1rem的div的getPropertyValue('width'),这个值是个精确值,会保留小数部分。
var defaultFontSize = parseFloat(window.getComputedStyle(d, null).getPropertyValue('width'));
document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px / defaultFontSize * 100 + '%';
源码中font-size的值和width的值都会有同样的问题,所以要看1rem目标值和1rem实际值之间没有差值或差值比较小才是精确的。
from rem.
恩,这个我知道,
但是显示出来的6.4的计算值[按设置后的fontSize计算]是371px左右,而期望得到的是360px左右
最后一行的结论在我所提到的那款手机上width的精度要低于font-size的值,而且6.4rem的实际宽度是按font-size的值而非width的值来计算的
下图是4.2方案的截图
而且根据上图可知,设置前1rem的宽度并不是设置前html的fontSize的精确值,25和26之间不是四舍五入可以得到的结果
from rem.
Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; HUAWEI P6-U06 Build/HuaweiP6-U06) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30,这是对应的user agent.融合搜索的浏览器
from rem.
你用的这个浏览器华为的应用市场都已经下架了吧,没有找到p6,6p测试没问题,orz...
设置系统字体「特大」的时候不会影响到浏览器,我测试设置前html的fontSize也就是21px,没到26px的情况。
from rem.
华为C8817,OPPO R9M,你值得拥有(都会出现这种情况)
from rem.
Related Issues (16)
- 关于dpr HOT 2
- 此方案字体大小可否直接使用rem单位? HOT 3
- 如果设计稿是750px的,adapt函数设置需要更改成(750,117.1875)吗 HOT 1
- html设定为固定的px,就不会随系统字体大小改变了,所以不明白方案3为什么是不行的? HOT 1
- 关于18px下分析的几个值的问题 HOT 1
- 手机 4k 屏幕下 如何适配 HOT 1
- 关于竖屏横屏的问题
- chrome下手机测试失效。 HOT 3
- 设计稿如果是750 HOT 3
- 目前成熟方案:flexible HOT 2
- .0.0.
- 关于方案3的一个问题 HOT 8
- 在谷歌浏览器上模拟手机调试字体不能自动变化 要手动刷新 是什么原因 HOT 3
- 关于在ie中的一些问题 HOT 2
- 求解释rem2px的值 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rem.