[英]div inside ul causing problems in IE7
I have a <ul
> which contains many lis and divs. 我有一个
<ul
>,其中包含许多lis和div。 The li's are autogenerated from inputs and labels, and the divs are floated right and serve as tooltips to explain each input. li会根据输入和标签自动生成,并且div会向右浮动并用作说明每个输入的工具提示。
The code is something as follows: 代码如下:
<ul>
<div>tooltip</div>
<li>input</li>
<div>tooltip</div>
<li>input</li>
<div>tooltip</div>
<li>input</li>
</ul>
This works fine in firefox and IE8, but in IE7, it assumes that each div is part of the previous <li
>, and completely drops the </li
> tags from the interpreted source code (found out from IEtester's View Source Code dev tool). 这在firefox和IE8中工作正常,但在IE7中,它假定每个div都是以前的
<li
>的一部分,并从解释后的源代码中完全删除</li
>标签(可从IEtester的View Source Code dev工具中找到) )。 Anyone know why this is happening and how to ammend it? 有人知道为什么会发生这种情况以及如何对其进行修正吗?
CSS: CSS:
.tooltip { float: right; width: 140px; font-size: 0.9em; padding: 9px 9px 9px 15px; margin-top: 15px; }
You can't have div inside the <ul>
directly. 您不能直接在
<ul>
包含div。 They can go inside the <li>
elements though. 他们可以进入
<li>
元素。 This may or may not help with the problem you're having but should be fixed to make sure it isn't the cause. 这可能会或可能不会帮助您解决所遇到的问题,但应将其修复以确保不是问题的起因。
<ul>
<li>input<div>tooltip</div></li>
<li>input<div>tooltip</div></li>
<li>input<div>tooltip</div></li>
</ul>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.