2

ドキュメントを XHTML 1.0 Transitional (W3C) として検証しようとしています。次のエラーがあります: ドキュメント タイプでは要素 "div" が許可されていません。このコードに対応する「object」、「applet」、「map」、「iframe」、「button」、「ins」、「del」開始タグのいずれかが欠落しています:

<div style="clear: both;"></div>

また、エラー: ドキュメント タイプでは要素 "p" が許可されていません。「object」、「applet」、「map」、「iframe」、「button」、「ins」、「del」開始タグのいずれかが欠落しています

<p><span class="form-span">Do <input type="checkbox" name="own" value="yes" /> rent <input type="checkbox" name="rent" value="yes" /> other <input type="checkbox" name="rentother" value="Other" /></span></p>

コードフラグメント:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional
...
<body>
<form id="form1" ...>
...
<div style="clear: both;"></div>
<p><span class="form-span">Do <input type="checkbox" name="own" value="yes" /> rent <input type="checkbox" name="rent" value="yes" /> other <input type="checkbox" name="rentother" value="Other" /></span></p>
<div style="clear: both;"></div>

<span style="width:100%;">
...
<input id="i1oc_yes" type="radio" name="i1oc" value="yes" />
<input id="i1oc_no" type="radio" name="i1oc" value="no" />
...
<div style="clear: both;"></div>
...
</span>

何が問題なのか教えてください。ありがとう!

4

1 に答える 1

1

Generally, Your problem consists of the following as stated by validator

One possible cause for this message is that you have attempted to put a block-level element (such as <p> or <table>) inside an inline element (such as <a>, <span>, or <font>).

So, in Your code, I see, that <div> element is inside the <span> element which is not a valid XHTML.

Reference:

Block-level elements

Inline elements

and as stated on this page:

Generally, inline elements may contain only data and other inline elements.

于 2015-01-20T23:43:10.033 に答える