【问题标题】:Why this code showing error in W3C validator?为什么此代码在 W3C 验证器中显示错误?
【发布时间】:2010-06-10 16:15:26
【问题描述】:

为什么此代码在 W3C 验证器中显示错误“此处不允许使用字符数据”

<blockquote>all visible objects, man, are but as pasteboard masks. 
        But in each event -- in the living act, the undoubted 
        deed -- there, some unknown but still reasoning thing 
        puts forth the mouldings of its feature from behind 
        the unreasoning mask. If man will strike, strike 
        through the mask. All visible objects, man, are but as pasteboard masks. 
        But in each event -- in the living act, the undoubted 
        deed -- there, some unknown but still reasoning thing 
        puts forth the mouldings of its feature from behind 
        the unreasoning mask. If man will strike, strike 
        through the mask.</blockquote>

这个验证器http://www.onlinewebcheck.com/没有给出任何错误

【问题讨论】:

  • 我从没听说过 onlinewebcheck.com,但是 W3C 验证器是权威的。

标签: xhtml w3c-validation


【解决方案1】:

您不能将文本放在&lt;blockquote&gt; 标记内。您必须将其包装在另一个元素中,例如 &lt;p&gt; 标签:

<blockquote>
  <p>My text.</p>
</blockquote>

【讨论】:

    【解决方案2】:

    blockquote 不应直接包含文本。在验证之前,您需要将文本包装在单个 p 标记或一系列 p 标记中。

    【讨论】:

      【解决方案3】:

      注意:要将块引用元素验证为严格的 HTML/XHTML,该元素必须仅包含其他块级元素,如下所示:

      这里是长引用这里是长引用

      来源:w3schools.com

      【讨论】:

      • 废话,一个 w3schools 页面,实际上有准确和有用的信息!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 2022-01-08
      • 2015-10-22
      相关资源
      最近更新 更多