基础表单 - 验证错误“结束div标签,但打开元素”

时间:2013-10-05 03:35:48

标签: html css forms

我正在尝试使用基础框架设置表单的样式,并且它不喜欢将表单的部分(即提交按钮)拆分为全新的ROW。它抛出了这些错误;

看到结束标记div,但是有开放元素。 323 未封闭的元素形式。 296 迷路结束标签形式。 329

Here is a working fiddle

这是我的代码;

<!-- Contact -->
<div class="row"> <!-- dreamweaver says these overlap or unclosed-->
<div class="large-12 small-centered columns"> <!-- dreamweaver says these overlap or unclosed-->
<div class="small-12 small-centered large-9 columns"> <!-- dreamweaver says these overlap or unclosed-->

<form method="post" action="#" id="contact_form">
<div class="row">
<div class="large-6 columns">
<label for="contact_name">Your Name<em>*</em></label>
<input type="text" id="contact_name" name="contact_name" class="required" />
</div>
<div class="large-6 columns">
<label for="contact_email">Your Email<em>*</em></label>
<input type="email"  id="contact_email" name="contact_email" class="required email">
</div>
</div>
<div class="row">
<div class="large-6 columns">
<label for="contact_company">Company Name or Organization</label>
<input type="text" id="contact_company" name="contact_company"/>
</div>
<div class="large-6 columns">
<label for="contact_phone">Phone Number</label>
<input type="tel" id="contact_phone" name="contact_phone"/>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label for="contact_message">Your Message<em>*</em></label>
<textarea id="contact_message" name="contact_message" class="required"></textarea>
</div>
</div>
</div> <!-- line 323 - dreamweaver says these overlap or unclosed-->
</div> <!-- dreamweaver says these overlap or unclosed-->
</div> <!-- dreamweaver says these overlap or unclosed-->

<div class="row"> <!-- dreamweaver says these overlap or unclosed-->
<div class="large-4 small-centered columns"> <!-- dreamweaver says these overlap or unclosed-->
<input type="submit" name="contact_submit" class="medium button expand-fix no-border" value="SEND MESSAGE"/></form>
</div> <!-- dreamweaver says these overlap or unclosed-->
</div> <!-- dreamweaver says these overlap or unclosed-->

如果我在行323下面嵌套最后一行它可以工作,但按钮不会根据需要填充列(因为它是一行&gt;行而不是全宽)。

这让我感到困惑!谢谢你的期待!

1 个答案:

答案 0 :(得分:1)

您的一个输入元素未公开:

<input type="email"  id="contact_email" name="contact_email" class="required email">

应该是:

<input type="email"  id="contact_email" name="contact_email" class="required email"/>

此外,更重要的是,您的表单标记在div(小12个小中心的大9列)内开始,但该div在表单标记之前关闭。我不确定你的理想布局是什么意思,所以我无法向你展示确切的修复方法,但是在底部附近的区域中有太多的结束div标签,你得到了所有的评论。其中一些不应该在表单元素之后关闭。

仔细检查你的代码,并确保你的元素被正确封闭,并且在关闭元素之前不要先关闭元素。