Home > Web Front-end > HTML Tutorial > 网页加载速度优化2先加载css,然后再加载js文件。_html/css_WEB-ITnose

网页加载速度优化2先加载css,然后再加载js文件。_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:19:39
Original
1207 people have browsed it

网页加载时,是按从上到下,从左到右的顺序加载的。所以一定要先加载css文件(不要让用户看到一个杂乱无章的页面),最后再加载js文件,<br />js一般都是处理功能的,所以不需要提前加载。先给用户观感,再给用户上手体验。<br /><br /><!DOCTYPE html><br /><html lang="en"><br /><head><br />    <meta charset="UTF-8"><br />    <title>Title</title><br />    <!--先加载css --><br />    <link rel="stylesheet" href="style.css"><br /></head><br /><body><br /><!--然后加载网页内容 --><br /><h1>this is a demo html </h1><br /><br /><!--最后加载js文件--><br /><script src="index.js"></script><br /></body><br /></html>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template