[html5] self-closing tags in html5

Ian Hickson ian at hixie.ch
Tue Aug 5 05:20:56 PDT 2008


On Tue, 5 Aug 2008, Stephen Stewart wrote:
> 
> I was reading a presentation on HTML5[1] which included this:
> ---
> text/html: boilerplate
> 
> <!DOCTYPE html>
> <html>
>  <head>
>   <meta charset="utf-8" />
> ---
> 
> Why is the meta element self-closing? I thought self closing tags were a 
> product of XML?

In HTML5 we've allowed the / on void elements (like <meta>, <img>, <br>, 
<input>, etc), to ease migration to and from XML.

This is defined here (step 6):
http://www.whatwg.org/specs/web-apps/current-work/#start

See also:
http://wiki.whatwg.org/wiki/FAQ#Should_I_close_empty_elements_with_.2F.3E_or_.3E.3F

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the Help mailing list