What does the media = "" attribute mean in an HTML style sheet definition?

I am sure that some of you have seen the following:

<link rel="stylesheet" src="styles.css" media="screen,projection" />
<link rel="stylesheet" src="styles.css" media="print" />

Or something else...

But what does a media attribute actually do? I created several websites, and I never used multimedia attributes when linking style sheets. This is mistake?

Thanks Amit

+3
source share
3 answers

w3 can explain this best.

Media types are related to which media should be used to view the page.

- , CSS print media CSS. - , CSS print , .

- , - , .

- -.

+12

- . , .

media ; , . media "screen"; , .

", "; , , .

W3C (, CSS).

+5

, .

See http://www.w3.org/TR/CSS21/media.html . This functionality has been enhanced with media queries: http://www.w3.org/TR/css3-mediaqueries/ .

+1
source

Source: https://habr.com/ru/post/1757572/


All Articles