Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 第485天 css加载会阻塞js运行吗? #2770

Open
haizhilin2013 opened this issue Aug 12, 2020 · 3 comments
Open

[css] 第485天 css加载会阻塞js运行吗? #2770

haizhilin2013 opened this issue Aug 12, 2020 · 3 comments
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第485天 css加载会阻塞js运行吗?

3+1官网

我也要出题

@haizhilin2013 haizhilin2013 added the css css label Aug 12, 2020
@longhui520
Copy link

@GhostyCHEN
Copy link

总结上面的文章:
1.css加载会阻塞后面js的运行
2.css加载不会阻塞DOM的解析,但是会阻塞DOM的渲染 --> 考虑到css可能会修改DOM的样式,从而引起回流或重绘,所以先加载完css,再对DOM进行渲染,减少不必要的性能损耗
3.提高css加载速度的方式:

CDN
压缩css文件
合理使用缓存
合并css文件

@zhangyu-lucy
Copy link

1.css加载不会阻塞Dom的解析
2.css加载会阻塞Dom的渲染
3.css加载会阻塞后面js的运行
优化:
1.使用cdn
2.压缩css文件,合并css文件
3.合理使用缓存
4.如果样式少的话使用内联,内联做不到的就是缓存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

4 participants