简体   繁体   English

HTML无序列表在IE7中很烂

[英]HTML unordered list sucks in IE7

I've created a HTML ordered list which looks fine in FF, but pretty awful in IE. 我创建了一个HTML有序列表,在FF中看起来不错,但在IE中却很糟糕。 My specific problems with the way IE displays the list are: 我对IE显示列表的方式的具体问题是:

  1. List markers are missing 列表标记丢失
  2. Vertical spacing between list items is very uneven 列表项之间的垂直间距非常不均匀

It seems the superscripts are the cause of (2), but I'm not sure how I can fix this problem (without removing the superscripts). 似乎上标是(2)的原因,但我不确定如何解决此问题(不删除上标)。

EDIT: I gave up on my single-list dreams and split the list into 3 separate lists. 编辑:我放弃了我的单身梦想,将清单分为3个单独的清单。 I've removed the link from the text above to avoid confusing future readers. 我已从上面的文本中删除了该链接,以避免使以后的读者感到困惑。

Thanks, Don 谢谢唐

This is a known bug of IE5, IE6, and still in IE 7. 这是IE5,IE6的已知错误,并且仍在IE 7中。

IE 8 Beta 2 and the latest, IE 8 RC1, will display your web page correctly. IE 8 Beta 2和最新的IE 8 RC1将正确显示您的网页。

But these are a list of list item bug before IE 8: 但是这些是IE 8之前的列表项错误的列表:

http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/ http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/

http://gtwebdev.com/workshop/gaps/white-space-bug.php http://gtwebdev.com/workshop/gaps/white-space-bug.php

If it's the list at the bottom of the page, you've got a bunch of whitespace inside your list tags. 如果它是页面底部的列表,则列表标记内有很多空格。 I don't know if that's causing the problem, but you might want to try eliminating it and see if that helps. 我不知道是否是造成问题的原因,但是您可能想尝试消除它,看看是否有帮助。 The superscripts may also be throwing things off. 上标也可能使事情丢掉。 Try giving the list itself a line height of 2em (or more) and see if that evens things out. 尝试使列表本身的行高为2em(或更高),并查看是否使结果均匀。

EDIT : you might also want to play with the left padding/margin on the list items and increase it to see if that brings the list markers back. 编辑 :您可能还想在列表项上使用左填充/边距,然后增加它以查看是否使列表标记返回。 I've had to do this with list-based menus to get my menu items to show up in the proper alignment. 我必须对基于列表的菜单执行此操作,以使菜单项以正确的对齐方式显示。

I can tell for certain that the superscripts are what's altering the line height. 我可以肯定地说上标是改变行高的原因。 If you want to force regular line heights you'll have to wrap everything in a table to prevent flow-based layount. 如果要强制使用规则的行高,则必须将所有内容包装在表中,以防止基于流的布局。

can you set the height of the li elments to account for the superscript? 您可以设置元素的高度来说明上标吗? probably best to do that in CSS. 最好在CSS中做到这一点。

As others mentioned the height is due to the superscripted text. 正如其他人提到的,高度是由于上标文字。

As for the bullets Floating a list-item doesn't work well in IE. 至于项目符号,浮动列表项在IE中效果不佳。 If you plan on doing a three column layout try something like this. 如果您打算进行三列布局,请尝试以下操作。

<style type="text/css">
ul {  
  float:left;
  padding:2em;
  width:14em;
}
</style>

<ul>
 <li>col1 - item1</li>
 <li>col1 - item2</li>
 <li>col1 - item3</li>
</ul>

<ul>
 <li>col2 - item1</li>
 <li>col2 - item2</li>
 <li>col2 - item3</li>
</ul>

<ul>
 <li>col3 - item1</li>
 <li>col3 - item2</li>
 <li>col3 - item3</li>
</ul>

您可能会看到子弹是否消失,因为您将左浮动与填充耦合在一起-不知道IE如何将子弹算作大小计算的一部分。

try doing this for your LI's 尝试为你的LI做这个

<li>text</li><li>text</li><li>text</li><li>text</li><li>text</li><li>text</li>

Don't add in any line breaks. 不要添加任何换行符。 It's silly that this might fix it, but it's true. 这可能会解决这个问题很愚蠢,但这是事实。

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

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