2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HTML > headタグに記載した内容がbodyタグ内に移動してしまっている

2
Posted at

状況

何でも良いのですが、以下のようなhtmlファイルがあるとします。

<!DOCTYPE=html>
<html>
<head>
 <script type="text/javascript" src="js/test.js"></script>
</head>
<body>
テスト
<body>
</html>

上記をブラウザで表示すると、以下のようにheadタグ内に記載した内容がbodyタグに移動してしまっている。
スクリーンショット 2019-03-29 23.57.10.png

原因

headタグ内に全角スペースが入力されているから。

ASP.NETで既存のWEBページにあとからmasterpageを設置するという作業でハマった。
masterpageが原因かという思い込みにとらわれてしまった・・・。
既存のページは単にheadタグの記載がbodyにずれるだけだから、
表示自体には問題がなかっただけ。

ちなみにVisual Studioでエディタにスペースを表示させる方法は、
メニューバーの[編集]-[詳細]-[スペースの表示]を選ぶ。

2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?