Comments (17)
写的很好
from blog.
你好!vw和vh我是用设计稿的宽和高来计算元素的值,写在页面里面,
例:24(元素)÷750(设计稿)×100(转换vw)=3.2vw,
高度也是这样计算的,chrome浏览器vw宽度是没有问题,
vh高度却比设计稿少三分之一请问你知道为什么吗?
from blog.
你好!vw和vh我是用设计稿的宽和高来计算元素的值,写在页面里面,
例:24(元素)÷750(设计稿)×100(转换vw)=3.2vw,
高度也是这样计算的,chrome浏览器vw宽度是没有问题,
vh高度却比设计稿少三分之一请问你知道为什么吗?
vw和vh都是根据视口来确定实际像素的,视口上的宽度和高度比例不一定是1:1 的,而且一般来说,vh和vw不用同时使用,使用vw一般就满足移动端适配的要求了
from blog.
你好!vw和vh我是用设计稿的宽和高来计算元素的值,写在页面里面,
例:24(元素)÷750(设计稿)×100(转换vw)=3.2vw,
高度也是这样计算的,chrome浏览器vw宽度是没有问题,
vh高度却比设计稿少三分之一请问你知道为什么吗?vw和vh都是根据视口来确定实际像素的,视口上的宽度和高度比例不一定是1:1 的,而且一般来说,vh和vw不用同时使用,使用vw一般就满足移动端适配的要求了
谢谢你的回复,有时候会用到vh。我找到问题了,不应该用设计图上的高度,它很高,应该用@2×(两倍图)的宽度和高度,个人疏忽造成的。
from blog.
写得好清楚,可以转载你的这篇文章吗?
from blog.
写得很好~
from blog.
mark
from blog.
mark
from blog.
REM计算有问题吧?
function refreshRem() {
var docEl = doc.documentElement;
var width = docEl.getBoundingClientRect().width;
var rem = width / 10;
docEl.style.fontSize = rem + 'px';
flexible.rem = win.rem = rem;
}
win.addEventListener('resize', refreshRem);
这段代码逐行分析一下
第一行doc 是指document? doc.documentElement 是指document.documentElement?既docEl 指html
第二行width = docEl.getBoundingClientRect().width;也就是PC情况下width = 2560,
第三行rem = width / 10; 也就是256
第四行docEl.style.fontSize = rem + 'px'; 一个fontSize 等于256px(比牛逼都大个)
第五行flexible.rem = win.rem = rem;不知道是从哪里来往哪去
这么好的文章总结希望再严谨验证一下
from blog.
写的很好,概述的非常明白
from blog.
from blog.
mark
from blog.
他们说的逻辑像素是什么?
1 DPR = 物理像素/分辨率
像素和分辨率之间可以相除吗?为啥有些地方说分辨率是指纵横向上的像素点数
from blog.
from blog.
写的太好了,我想转载您的多篇文章到我的自己的博客上,追赶您的脚步
from blog.
from blog.
from blog.
Related Issues (20)
- Typescript中的内置类型以及内置类型的实现原理
- 聊一聊Typescript中与this相关的类型定义
- 转载申请 HOT 1
- 深入的聊一聊Typescript中的module和namespace
- 深入浅出浏览器中的ES modules
- Typescript代码整洁之道 HOT 1
- Node server typescript改造指南
- 深入浅出前端微服务及其实现原理 HOT 1
- skypack原理,如何快速实现comonjs到esm的转化
- 深入浅出svelte.js
- js打包时间缩短90%,bundleless生产环境实践总结 HOT 2
- 深入浅出pixi.js
- pixi.js源码阅读
- 深入浅出fabricjs
- 优雅的阅读fabricjs的源码
- 深入聊一聊__esModule HOT 1
- 深入谈谈React18.x
- 深入聊聊package.json HOT 4
- 深入浅出Nodejs中的大文件读写
- 如何优雅的使用tailwindcss
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 blog.