JavaScript和CSS顺序 [英] JavaScript and CSS order

查看:85
本文介绍了JavaScript和CSS顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接到CSS文件和JavaScript文件的HTML文件。



先执行JavaScript然后应用CSS,反之亦然?



有任何方法可以更改订单吗?



谢谢!


<当< script> 元素被解析时,JavaScript会被执行。一些JS可能会设置事件处理程序来在事件发生时运行一些JS。



CSS应用于活动DOM。对DOM的更改会自动应用CSS。对CSS的更改会自动应用于整个DOM。


I have an HTML file which is linked to CSS file and also to JavaScript file.

Is JavaScript executed first and then the CSS is applied, or vice versa ?

Is there any way to change the order ?

Thanks !

解决方案

The JavaScript gets executed when the <script> element is parsed. Some of the JS might set up event handlers to run some JS when events happen.

CSS is applied to the live DOM. Changes to the DOM get CSS applied automatically. Changes to CSS apply to the whole DOM automatically.

这篇关于JavaScript和CSS顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆