When the CSS file does not match the HTML type declaration of the media content, is it still loaded?

when i have

<link type= "text/css" rel="stylesheet" media="screen and (max-width: 480px)" href="css/480.css"> 

and the page is not within the request parameters, will the device download the CSS file, but will not display it or will not load at all? And when the page changes and is now suitable for asking, will the file load?

+4
source share
1 answer

No matter what media says, it will be downloaded. You are better off using @media blocks inside your main stylesheet if the goal is to improve performance.

Cm:

I'm not sure if this is good or bad, but considering your question:

When the page changes and now matches the query, will the file load?

If that were the case, there is a good chance that the user will experience some lag waiting for CSS to load β€œon demand”.

+3
source

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


All Articles