HTML 区域媒体属性用于指定目标 URL 优化的媒体或设备。
此属性指定用于特定设备(如印刷媒体或语音)的样式。该属性可以接受多个值。仅在存在 href 属性时使用。此属性纯粹是建议性的。
句法:
可能的运营商:
Value | Description |
---|---|
and | AND operator |
not | NOT operator |
, | OR operator |
设备:
Value | Description |
---|---|
all | Suitable for all devices |
aural | Speech synthesizers |
braille | Braille feedback devices |
handheld | Handheld devices (small screen, limited bandwidth) |
projection | Projectors |
Print preview mode/printed pages | |
screen | Computer screens |
tty | Teletypes and similar media using a fixed-pitch character grid |
tv | Low resolution or limited scroll ability type devices like Television. |
价值观:
Value | Description |
---|---|
width | Targeted display area’s width. |
height | Targeted display area’s height |
device-width | Target display or paper’s width. |
device-height | Target display or paper’s height. |
orientation | Target display or paper’s orientation. |
aspect-ratio | Width/height ratio of the targeted display area. |
device-aspect-ratio | Device-width/device-height ratio of the target display/paper. |
color | Bits per color of target display. |
color-index | Number of colors the target display can handle. |
monochrome | Bits per pixel in a monochrome frame buffer. |
resolution | Pixel density (dpi or dpcm) of the target display/paper. |
scan | Scanning method of a tv display. |
grid | If the output device is grid or bitmap. |
注意:可以使用像“min-”和“max-”这样的前缀。
例子:
html
HTML area rel Attribute
输出:
在点击特定的可点击区域之前
点击特定的可点击区域后
支持的浏览器: HTML area media 属性支持的浏览器如下:
- 谷歌浏览器
- IE浏览器
- 火狐
- 苹果Safari
- 歌剧