LoginSignup
2
1

More than 5 years have passed since last update.

HTML5で閉じタグがいらないやつ

Last updated at Posted at 2018-05-31

HTMLを書いてるときに閉じタグがいらないタグがあって、いるのかいらないのか迷ったので調べた。
HTML5の仕様では以下のタグはVoid elementsと呼ばれ閉じタグが存在しない。

Void elements

area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr
https://www.w3.org/TR/html5/syntax.html#writing-html-documents-elements

HTML5でのVoid elementsの書き方

<br>
<br/>
<br />

上記ならhttps://validator.w3.orgでErrorにならなかった。

以下の書き方はError

<br></br>
2
1
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
1