最新的Web开发教程
 

HTML <area> media Attribute

<HTML <area>标签

图像映射,具有可点击区域:

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun"
href="sun.htm" media="screen and (min-color-index:256)">
</map>
试一试»

定义和用法

media属性指定的介质/设备的目标URL被优化。

此属性用于指定的URL是专为特殊设备(如iPhone),语音或打印介质。

这个属性可以接受多个值。

仅当使用href属性存在。

注:此属性是纯粹的咨询。


浏览器支持

属性
media Yes Yes Yes Yes Yes

HTML 4.01和HTML5之间的差异

media属性,HTML5是新的。


句法

<area media="value">

可能的Operators

描述
and 指定AND运算符
not 指定NOT运算符
, 指定OR运算符

设备

描述
all 默认。 适用于所有设备
aural 语音合成器
braille 盲文反馈装置
handheld 手持设备(小屏幕,有限的带宽)
projection 投影机
print 打印预览模式/打印页面
screen 电脑屏幕
tty 使用固定宽字符网格的电传打字机和类似媒体
tv 电视类型设备(低分辨率,有限的滚动能力)

描述
width 指定目标的显示区域的宽度。
"min-""max-"可使用的前缀。
例如: media="screen and (min-width:500px)"
height 指定目标的显示区域的高度。 "min-""max-"可使用的前缀。
例如: media="screen and (max-height:700px)"
device-width 指定目标显示器/纸张的宽度。
"min-""max-"可使用的前缀。
例如: media="screen and (device-width:500px)"
device-height 指定目标显示器/纸张的高度。
"min-""max-"可使用的前缀。
例如: media="screen and (device-height:500px)"
orientation 指定目标显示/纸的方向。
可能的值: "portrait""landscape"
例如: media="all and (orientation: landscape)"
aspect-ratio 指定目标的显示区域的宽度/高度比。
"min-""max-"可使用的前缀。
例如: media="screen and (aspect-ratio:16/9)"
device-aspect-ratio 指定目标显示/纸的设备宽度/设备高度比。
"min-""max-"可使用的前缀。
例如: media="screen and (aspect-ratio:16/9)"
color 指定每个目标的显示颜色的位。
"min-""max-"可使用的前缀。
例如: media="screen and (color:3)"
color-index 指定颜色目标显示可以处理的数量。
"min-""max-"可使用的前缀。
例如: media="screen and (min-color-index:256)"
monochrome 指定在单色帧缓冲器每像素的位。
"min-""max-"可使用的前缀。
例如: media="screen and (monochrome:2)"
resolution 指定目标显示器/纸张的像素密度(DPI或DPCM)。
"min-""max-"可使用的前缀。
例如: media="print and (resolution:300dpi)"
scan 指定一个电视显示器的扫描方法。
可能的值是"progressive""interlace"
例如: media="tv and (scan:interlace)"
grid 指定是否输出设备是电网或位图。
可能的值是“1”的网格,和“0”,否则。
例如: media="handheld and (grid:1)"

<HTML <area>标签