LoginSignup
367

More than 5 years have passed since last update.

<html>,<body>は要らない?Googleが推奨するHTMLファイルの記法

Last updated at Posted at 2013-06-20

Googleが公開していたGoogle HTML/CSS Style Guideによると、よく使われる下のようなHTMLのお決まりの記法は非推奨らしい。

not_recommended.html
<!DOCTYPE html>
<html>
  <head>
    <title>Spending money, spending bytes</title>
  </head>
  <body>
    <p>Sic.</p>
  </body>
</html>

これはファイル容量のために下のように書くべき。

recommended.html
<!DOCTYPE html>
<title>Saving money, saving bytes</title>
<p>Qed.

つまりhtml, head, bodyなどの使い慣れたお決まりのタグは今更書くまでもないということ。

参考: どのようなタグが省略可能か
http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#syntax-tag-omission

P.S.
STORYS.JPcoincheck などのサービスを運営、開発しています。興味のある方はぜひ 和田まで連絡を!

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
367