HTML - attributes - media

revision:


Content

"media" attribute : specifies the media/device for a linked document syntax some examples


"media" attribute : specifies the media/device for a linked document

top

It specifies what media/device the linked document is optimized for. This attribute is used to specify that the target URL is designed for special devices (like iPhone), speech or print media. This attribute can accept several values.

The media attribute can be used on the following elements: <a>, <area>, <link>, <source>, <style>.


syntax

top

<a media="value"> : only used if the "href attribute" is present. this attribute is purely advisory.

<area media="value"></a> : only used if the href attribute is present. This attribute is purely advisory.

<link media="value">

<source media="media_query">

<style media="value"></a>


some examples

top
Click to open in the same tab
Click to open in a different tab
codes:
                    <a href="https://lwitters.com" media="print and (resolution:300dpi)">
                        Click to open in the same tab
                    </a>
                    <br>
                    <a href="https://lwitters.com" target="_blank" media="print and (resolution:300dpi)">
                        Click to open in a different tab
                    </a>