html - 列表项元素符号在 IE6 和 IE7 中消失

标签 html css internet-explorer html-lists

我使用 <ul> 创建了一个元素列表和 <li> .它在 Firefox 中运行良好,但在 Internet Explorer 6 和 7 中我看不到列表元素符号。

这是我所做的:
我有一个全局 ul , li重置值。之后,我使用两个 <ul> 创建了两列列表堵塞。我正在覆盖 ul li CSS 中的全局样式值 none 将样式列为 disc .当我这样做时,我可以看到元素符号列表项,但是当我设置 ulli 的某个特定值的宽度元素符号在 IE 中消失。

即使我使用列表样式作为 list-style-image: url(bullet.gif)也不会出现在 IE 6 和 7 中。

这是 HTML 代码。请看看这个,让我知道我可以在所有浏览器中存档元素符号列表的方法。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>List Sample</title>
<style>
* { padding: 0; margin: 0; }

body { font-size: 62.5%; background-color:#ffffff; font-family:Arial, Helvetica, sans-serif; color:#000000;margin:0; }
p,ul { font-size: 1em; }
li { list-style: none; font-size: 1em }
.clear { clear: both; height:0px; font-size:0px;}

#box1{ font-size:1.5em; margin:10px 0px 0px 10px; width:350px; border:1px solid red; padding:10px 20px; clear:both;}
#box1 ul#listLeft{ display:inline;}
#box1 ul#listLeft li{ list-style:disc; border:1px solid red; width:150px; float:left;}
#box1 ul#listRight li{ list-style:disc; border:1px solid red; width:150px; float:left;}
</style>

</head>
<body>
<div id="box1">
<ul id="listLeft">
<li>Popular articles</li>
<li>Submit news</li>
<li>Newsletter</li>
<li>Design contest</li>
<li>Winners list</li>
</ul>
<ul id="listRight">
<li>Popular articles</li>
<li>Submit news</li>
<li>Newsletter</li>
<li>Design contest</li>
<li>Winners list</li>
</ul>
<div class="clear"></div>
</div>
</body>

最佳答案

对于 native disc bullets 你需要一些 margin,padding.. try with

ul li { margin:0 0 0 15px; padding:0 0 0 15px; }

并不断减少其中任何一个的左侧,直到您获得一致性(我忘记了哪个浏览器使用哪个 - 您可能只能依赖其中一个)。如果你想使用图像使用:

ul li { background:url(/images/bullet.gif); zoom:1; }

缩放是为了抵消 IE 的怪癖,但有时它会产生怪癖。不要忘记根据您的设计设置背景位置。

关于html - 列表项元素符号在 IE6 和 IE7 中消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1592935/

相关文章:

javascript - 获取 jQuery 改变后的字符串

javascript - 如何使用 jQuery 计算和设置元素的高度?

javascript - 在按钮上使用自定义字体

internet-explorer - 博客URL崩溃Internet Explorer

html - Css3 列水平溢出

jquery - 不透明父项内部的透明子项

android - 在 PhoneGap/Chrome 应用程序中存储视频以供离线使用

css - 使用 CSS3 转换延迟鼠标移开/悬停

CSS Flip 卡片 Internet Explorer 问题

html - IE 不居中这些图像,有解决办法吗?