- 在线时间
- 475 小时
- 专家
- 0
- UID
- 109800
- 注册时间
- 2004-6-8
- 帖子
- 1305
- 精华
- 0
- 积分
- 3458
- 居住地
- 湖南省 长沙市
- 离线
- 92 天
专长: 前端制作,搜索引擎,品牌推广
- 帖子
- 1305
- 体力
- 3444
- 威望
- 14
- 居住地
- 湖南省 长沙市
|
发表于 2007-1-22 12:25:28
|显示全部楼层
我查了苏沈小雨的《css2.0中文手册》
px版本:CSS1 兼容性:IE3+ NS4+
说明:
像素(Pixel)。相对长度单位。
像素是相对于显示器屏幕分辨率而言的。譬如,WONDOWS的用户所使用的分辨率一般是96像素/英寸。而MAC的用户所使用的分辨率一般是72像素/英寸。
援引w3.org的讨论解释
16:20:33 [wendy]
debate about px
16:21:18 [wendy]
not to define how css defines px, it's an implementation issue w/how browsers handle px.
16:21:31 [wendy]
px is relative to hardware, while %, em, ex are relative to layout.
16:21:38 [wendy]
it is layout that we are more concerned about.
16:24:57 [wendy]
general approach we can take in our techs: replace relative with em and %, replace absolute with px
16:26:31 [wendy]
i.e., use em and % for things that change (font, width), use px for things that don't (margins)
px is relative to hardware, while %, em, ex are relative to layout.
px是相对于硬件的长度,em 字体宽 ex 字体高 是相对于布局的长度
w3.org 定义的 css2.0语法
有两种长度单位一种是相对一种是绝对,相对长度单位是通过另外一个长度属性来确定长度大小的。样式表使用相对单位更容易从中等大小缩放成其它的大小(例如从屏幕显示 到激光打印)
相对长度单位有em,ex,px 字体宽 字体高 像素
There are two types of length units: relative and absolute. Relative length units specify a length relative to another length property. Style sheets that use relative units will more easily scale from one medium to another (e.g., from a computer display to a laser printer).
Relative units are: em, ex, and px.
绝对单位是仅适用于物理属性输出(打印机传真等终端),绝对单位有 英尺in 厘米cm 毫米mm 点pt和派斯卡(我国四号铅字大小)
Absolute length units are only useful when the physical properties of the output medium are known. The absolute units are: in (inches), cm (centimeters), mm (millimeters), pt (points), and pc (picas).
绝对单位换算关系是1in = 2.54cm = 25.4 mm = 72pt = 6pc
另外px的dpi是可以调整的了,windows下面是96dpi,打开 桌面->属性-> 显示属性-> 高级->常规选项卡可以把96dpi换成150dpi。 使用print screen 抓图桌面也是得到96dpi的图,而不是72的了。
在mac操作系统下面 屏幕是72dpi 相差很多的了。在windows下面看起来是一样的,在别的系统就不一定了。
[ 本帖最后由 hero4u 于 2007-1-22 12:28 编辑 ] |
|