HTML propriétés des médias de la région
Exemples
Avec carte d'image cliquable zone:
<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>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun"
href="sun.htm" media="screen and (min-color-index:256)">
</map>
Essayez »
support du navigateur
Tous les principaux navigateurs prennent en charge les propriétés des médias
Définition et utilisation
attribut media spécifie l'URL cible sera affiché sur tout appareil.
La propriété est utilisée avec l'URL spécifiée est affichée sur le périphérique spécifié (par exemple, iPhone), audio ou des supports d'impression.
Cet attribut peut accepter plusieurs valeurs.
Seulement utiliser l'attribut href est nécessaire propriétés des médias.
Différences entre HTML 4.01 et HTML5
L'attribut media est nouveau dans HTML5.
grammaire
<area media="value">
possible opérateur
值 | 描述 |
---|---|
and | 指定 AND 操作符 |
not | 指定 NOT 操作符 |
, | 指定 OR 操作符 |
équipement
值 | 描述 |
---|---|
all | 默认。适应所有设备。 |
aural | 语音合成器 |
braille | 盲文反馈设备 |
handheld | 手持设备(小屏幕,有限的带宽) |
projection | 投影仪 |
打印预览模式/打印页数 | |
screen | 电脑屏幕 |
tty | 电传打字机和类似使用固定间距字符网格的介质 |
tv | 电视类型设备(分辨率低,滚动能力有限) |
valeur
值 | 描述 |
---|---|
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)" |
方向 | 指定目标显示/纸的方向。 可能值: "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 | Specifies the number of colors the target display can handle. 通常使用 "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 | 指定输出设备是电网或位图 grid的值为 "1", 其他的为 "0" 实例: media="handheld and (grid:1)" |