In this article, we learn how to define the media type of the style tag in HTML5.
Approach: The task can be simply done by using the media attribute of the <style> element. It is used to specify the style is for specific devices like print media or speech. This attribute can accept several values.
HTML Code: Below code illustrates the media attribute to define the media type of the style tag in HTML5. The below code specifies that styles are for screen and print media devices.
- Screen version output:
- Print version output: