HTML properti media daerah
contoh
Dengan area peta gambar yang dapat diklik:
<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>
Coba »
Dukungan Browser
Semua browser utama mendukung properti media
Definisi dan Penggunaan
media atribut menentukan target URL akan ditampilkan pada perangkat apapun.
Properti ini digunakan dengan URL tertentu ditampilkan pada perangkat tertentu (misalnya iPhone), audio atau media cetak.
Atribut ini dapat menerima beberapa nilai.
Hanya menggunakan atribut href diperlukan properti media.
Perbedaan antara HTML 4.01 dan HTML5
Atribut media baru dalam HTML5.
tatabahasa
<area media="value">
Operator mungkin
值 | 描述 |
---|---|
and | 指定 AND 操作符 |
not | 指定 NOT 操作符 |
, | 指定 OR 操作符 |
peralatan
值 | 描述 |
---|---|
all | 默认。适应所有设备。 |
aural | 语音合成器 |
braille | 盲文反馈设备 |
handheld | 手持设备(小屏幕,有限的带宽) |
projection | 投影仪 |
打印预览模式/打印页数 | |
screen | 电脑屏幕 |
tty | 电传打字机和类似使用固定间距字符网格的介质 |
tv | 电视类型设备(分辨率低,滚动能力有限) |
nilai
值 | 描述 |
---|---|
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)" |