EN
HTML - load CSS file in async mode
6 points
In this short article, we would like to show how to load CSS files asynchronously in HTML.
Quick solution:
xxxxxxxxxx
1
<link rel="stylesheet" href="/path/to/style.css" media="only x" onload="this.media='all'">
When the style file is loaded, media
rule is changed to all
devices, causing displaying loaded style.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<link rel="stylesheet" href="/path/to/style.css" media="only x" onload="this.media='all'">
5
</head>
6
<body>
7
Web page content here...
8
</body>
9
</html>