0
0

More than 3 years have passed since last update.

JavaScriptファイル参照の<script>タグの2つの配置場所

Posted at

1つ目:head要素内。他のstylesheet.cssの参照のように、head要素内に配置します。

2つ目:bodyタグの閉めタグ直前に配置する。(おすすめ)
(理由)
・JavaScriptファイルを読み込んでいる間は、HTMLファイルを読み込まないため、ページのレンダリング(表示)を行わせてからjavascriptファイルを読み込むんでページに動作をつけることで表示速度を早くする。

・CSSはheadタグ中に、javascriptはbodyタグの下にまとめて記述することでわかりやすくなる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0