使用HTML媒体属性来指定已优化耦合文档的媒体或设备。此属性指定目标URL是为iPhone,语音或打印媒体等特殊设备设计的。该属性可以接受多个值。
适用的:
例:HTML 媒体属性
HTML href Attribute
GeeksForGeeks
HTML href Attribute
media="print and (resolution:300dpi)">
media="print and (resolution:300dpi)">
Click to open in a different tab
输出:
例:HTML 媒体属性
content="width=device-width, initial-scale=1.0">
srcset=
"https://media.geeksforgeeks.org/wp-content/uploads/20190328185307/gfg28.png">
srcset=
"https://media.geeksforgeeks.org/wp-content/uploads/20190809013546/gfg_350X350.png">
"https://media.geeksforgeeks.org/wp-content/uploads/20190521140445/gfglogo2.png"
style="width:auto;">
输出:更改浏览器大小。
支持的浏览器:下面列出了HTML媒体属性支持的浏览器:
谷歌浏览器
IE浏览器
Firefox
苹果Safari
Opera