waredugu
V2EX  ›  问与答

html5 meta link img 的閉合方式

  •  
  •   waredugu · Jul 23, 2012 · 3750 views
    This topic created in 5228 days ago, the information mentioned may be changed or developed.
    dw cs6中是這樣:
    <meta charset="UTF-8">
    <link href="style.css" rel="stylesheet" type="text/css">
    <img src="bg.gif">

    為何不是xhtml那種了
    <img src="bg.gif" />
    4 replies  •  1970-01-01 08:00:00 +08:00
    chenluois
    chenluois
    Jul 23, 2012
    1
    两种闭合方式在 html5 里都对,不像 xhtml 必须自闭合。
    Air_Mu
    Air_Mu
    Jul 23, 2012
    2
    我也觉得少一个/比较美观
    bcxx
    bcxx
    Jul 23, 2012
    3
    @Air_Mu 我怎么觉得有 / 才好看= = 像内联元素?
    Sivan
    Sivan
    Jul 23, 2012
    4
    html 标准不需要关闭标签,html4 也允许那样,<p>、<li>都可以不关闭。
    xhtml 标准所有元素都要闭合,空元素自闭合,所以必须 <tag />。

    html5 的标准制定者希望保持 xhtml 那种干净不容易误解的模式,所以很多人还是鼓励使用 <tag /> 这样的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1855 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:11 · PVG 18:11 · LAX 02:11 · JFK 05:11
    ♥ Do have faith in what you're doing.