When a request is sent, the first thing to come back down is the HTML file. From that the DOM is constructed. When the HTML comes down the next thing is to request the CSS and script files. The order matters so for the sake of avoiding issues, load the CSS file(s) before running any script. After that, the media are requested and downloaded.