空 Div 导致非常奇怪的行为 [英] Empty Div Causing Very Strange Behavior

查看:25
本文介绍了空 Div 导致非常奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有这样的东西

<div></div><p>这里有一些文字</p>

这一切都在 XSL 的模板中调用.

出于某种原因,当它呈现空 div 从未关闭时,我得到了.

及其内容都在这个 div 中.每次调用此模板时,这都会继续下去.:(如果我只取出空的 div,所有的东西"div 都是独立的实体,而不是彼此内部.

怎么会这样?!

解决方案

尝试放置一个

&nbsp;

在空的 div 内.

Got something like this

<div class="something">

<div></div>

<p>
Some text here
</p>

</div>

This is all called in a template in XSL.

For some reason I am getting when it's rendered that the empty div is never closed. The <p> and its contents are inside this div. This continues on and on for each time this template is called. :( If I only take out the empty div, all the "something" divs are separate entities and not inside each other.

How could this be happening?!

解决方案

Try putting an

&nbsp;

inside the empty div.

这篇关于空 Div 导致非常奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆