CSS Pixel 和 Device pixels】的更多相关文章

Web developers need CSS pixels, that is, the pixels that are used in CSS declarations such as "  font-size:14px; ". These pixels have nothing to do with the actual pixel density of the device. They are  essentially an abstract construct created…
进行移动web开发已经有一年多的时间了,期间遇到了一些令人很困惑的东西.比如: 我们经常使用的<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">里的viewport究竟是什么意思,这里的device-width跟我们用JS获取到的屏宽的区别与联系分别是什么…
最近我做了一点儿针对手机的Web开发和相关研究.按说,Web自设计之初,就已经考虑了设备无关性.然而,现实总是不尽如人意. 我们知道大多数网页都是针对桌面显示器开发和测试的,但是手机屏幕通常要比桌面显示器小很多,比如iPhone也就是320px.那么那些网页在手机上如何浏览呢? 一种是把网页缩放到很小,你可以看到整个网页但是看不清字了:或者只看网页的一个局部,然后上下左右移动来看其他部分.现在的手机浏览器把两种模式结合使用.(或许还有第三种——分析网页,将其中内容抽取出来,重组,然后呈现,不过这…
内容转自 http://www.cnblogs.com/koukouyifan/p/4066567.html 非常感谢 口口一凡 为我们提供的这篇文章,受益匪浅,特地转到自己的博客收藏起来. 以下是原文内容. 进行移动web开发已经有一年多的时间了,期间遇到了一些令人很困惑的东西.比如: 我们经常使用的<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1…
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes"/> 手机端 window.screen.width 在手机端 获取到的是逻辑分辨率的宽度取物理分辨率的话,:window.screen.width *…
一些重要的名词解释: CSS pixels(CSS 像素):详见http://www.w3.org/TR/css3-values/#reference-pixe CSS声明的像素值,可随着放大缩小而放大缩小. Device pixels(设备 像素): Layout viewport(布局视口)设计像素值固定,对web开发者来说基本没有用. HTML元素初始视口区域,css中声明宽度的20%等都是按照这个视口来计算. Visual viewport (设备视口) 屏幕视口,通过这个视口能看到页面…
设备像素dp(device pixels) ppi(pixels per inch)表示每英寸所拥有的像素(pixel)数目,数值越高,代表屏幕能以更高的密度显示图像. 计算公式:ppi=像素数量/物理尺寸(英寸数) ppi就是设备像素dp(device pixels)的单位. 举例: 一个3.5寸的分辨率为320*480的屏幕a,ppi是(根号(320^2 + 480^2)) / 3.5 = 164,约等于160. 一个3.8寸的分辨率为480*800的屏幕b,ppi是(根号(480^2 +…
Canvas is great for high performance graphics rendering but by default the results look blocky on phones tablets and laptops with high pixel density or Retina displays. By using canvas width and height attributes and style props we can use window.dev…
1.PX(CSS pixels) 1.1 定义 虚拟像素,可以理解为“直觉”像素,CSS和JS使用的抽象单位,浏览器内的一切长度都是以CSS像素为单位的,CSS像素的单位是px. 1.2 注意 在CSS规范中,长度单位可以分为两类,绝对(absolute)单位以及相对(relative)单位.px是一个相对单位,相对的是设备像素(device pixel). 在同样一个设备上,每1个CSS像素所代表的物理像素是可以变化的(即CSS像素的第一方面的相对性); 在不同的设备之间,每1个CSS像素所代…
In CSS media the difference between width and device-width can be a bit muddled, so lets expound on that a bit. device-width refers to the width of the device itself, in other words, the screen resolution of the device. Lets say your screen's resolut…