简体   繁体   English

验证器错误。 你能帮助我吗?

[英]Error in validator. Can you help me?

Can you help me with this error on my web-site? 您可以在我的网站上为我解决此错误吗?

Error: document type does not allow element "div" here; 错误:此处的文档类型不允许元素“ div”; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag 缺少“对象”,“小程序”,“地图”,“ iframe”,“按钮”,“ ins”,“ del”开始标签之一

And I found this part of code: 我找到了这部分代码:

<?php foreach ($this->categories as $cat){
           echo '<span>'.$cat->category_name_rus.' ';
                if(count($cat->products)>0){
                    echo '<div class="hover"><ul>';
                        foreach ($cat->products as $product) {
                            echo '<li><a href="/product/'.$product->id.'"><div class="left_act">'.$product->product_name_rus.'</div><div class="right_act"></div></a></li>';
                        }
                echo '</ul><div></div></div>';
                }
           echo '</span>';
        }?>

What is wrong? 怎么了?

Reason: 原因:

you close the two times of div without open div 关闭两次div而不打开div

So Please Change 所以请改变

echo '</ul><div></div></div>';

into 进入

echo '</ul><div>';

More over <span> tag is inline element. 超过<span>标签的是内联元素。 div is not use as child element in a tag div不作为子元素中使用a标签

Semantically, you shouldn't have a span tag containing block elements such as divs . 从语义上讲,您不应该具有包含块元素(例如divsspan标签。 The HTML standard indicates that only phrasing elements should be contained in spans. HTML标准指示跨度中仅应包含短语元素。

Content model: Phrasing content. 内容模型: 短语内容。

Also from : 来自

Phrasing content is the text of the document, as well as elements that mark up that text at the intra-paragraph level. 短语内容是文档的文本,以及在段落内级别标记该文本的元素。 Runs of phrasing content form paragraphs. 段落内容的表述形式。

Please try this... 请尝试这个...

<?php foreach ($this->categories as $cat) : ?>
   <div>
        <span><?php echo $cat->category_name_rus.' '; ?></span>
        <?php
        if(count($cat->products)>0){
            ?>
            <div class="hover">
                <ul>
                    <?php
                    foreach ($cat->products as $product) {
                        ?>
                        <li>
                            <a href="/product/".<?php echo $product->id;?> >
                                <div class="left_act">
                                    <?php echo $product->product_name_rus; ?>
                                </div>
                                <div class="right_act">

                                </div>
                            </a>
                        </li>
                    <?php
                    }
                    ?>
                </ul>
            </div>';
        }
   </div>
<?php endforeach ?>

Hope it will help you.... 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM