简体   繁体   English

List Bullet在IE7中消失

[英]List Bullet Disappear in IE7

About 关于

So this question has been asked time and time again, but I noticed something a little different; 所以这个问题一次又一次被问到,但我注意到了一些不同的东西; see below . 见下文

Standard Info: 标准信息:

  • Bullet displays in FF 子弹显示在FF中
  • Bullet does not appear in IE Bullet没有出现在IE中

Finding 查找

  • The bullet disappears when setting a hasLayout on the <ul> element, not the <li> ; <ul>元素上设置hasLayout时子弹消失,而不是<li> ; this is often accomplished when doing *{zoom:1} 这通常在做* {zoom:1}时完成

Firebug in Internet Explorer Internet Explorer中的Firebug

UL: UL:

backgroundAttachment       "scroll" 
backgroundColor            "transparent" 
backgroundImage            "none" 
backgroundRepeat           "repeat" 
borderBottomColor          "#000000" 
borderBottomStyle          "none" 
borderBottomWidth          "medium" 
borderCollapse             "separate" 
borderColor                "#000000" 
borderLeftColor            "#000000" 
borderLeftStyle            "none" 
borderLeftWidth            "medium" 
borderRightColor           "#000000" 
borderRightStyle           "none" 
borderRightWidth           "medium" 
borderStyle                "none" 
borderTopColor             "#000000" 
borderTopStyle             "none" 
borderTopWidth             "medium" 
borderWidth                "medium" 
bottom                     "auto" 
clear                      "none" 
color                      "#000000" 
cursor                     "move" 
direction                  "ltr" 
display                    "block" 
fontFamily                 "tahoma, arial, helvetica, sans-serif" 
fontSize                   "0.9em" 
fontStyle                  "normal" 
fontVariant                "normal" 
fontWeight                 400 
height                     "auto" 
left                       "auto" 
letterSpacing              "normal" 
lineHeight                 "normal" 
listStyleImage             "none" 
listStylePosition          "outside" 
listStyleType              "disc" 
margin                     "auto auto auto 30pt" 
marginBottom               "auto" 
marginLeft                 "30pt" 
marginRight                "auto" 
marginTop                  "auto" 
maxHeight                  "none" 
maxWidth                   "none" 
minHeight                  "auto" 
minWidth                   "auto" 
overflow                   "visible" 
padding                    "0px" 
paddingBottom              "0px" 
paddingLeft                "0px" 
paddingRight               "0px" 
paddingTop                 "0px" 
pageBreakAfter             "auto" 
pageBreakBefore            "auto" 
position                   "static" 
right                      "auto" 
tableLayout                "auto" 
textAlign                  "left" 
textDecoration             "none" 
textIndent                 "0pt" 
textTransform              "none" 
top                        "auto" 
unicodeBidi                "normal" 
verticalAlign              "auto" 
visibility                 "inherit" 
whiteSpace                 "normal" 
width                      "auto" 
wordSpacing                "normal"     

LI: 李:

backgroundAttachment       "scroll" 
backgroundColor            "transparent" 
backgroundImage            "none" 
backgroundRepeat           "repeat" 
borderBottomColor          "#000000" 
borderBottomStyle          "none" 
borderBottomWidth          "medium" 
borderCollapse             "separate" 
borderColor                "#000000" 
borderLeftColor            "#000000" 
borderLeftStyle            "none" 
borderLeftWidth            "medium" 
borderRightColor           "#000000" 
borderRightStyle           "none" 
borderRightWidth           "medium" 
borderStyle                "none" 
borderTopColor             "#000000" 
borderTopStyle             "none" 
borderTopWidth             "medium" 
borderWidth                "medium" 
bottom                     "auto" 
clear                      "none" 
color                      "#000000" 
cursor                     "move" 
direction                  "ltr" 
display                    "block" 
fontFamily                 "tahoma, arial, helvetica, sans-serif" 
fontSize                   "0.9em" 
fontStyle                  "normal" 
fontVariant                "normal" 
fontWeight                 400 
height                     "auto" 
left                       "auto" 
letterSpacing              "normal" 
lineHeight                 "normal" 
listStyleImage             "none" 
listStylePosition          "outside" 
listStyleType              "disc" 
margin                     "auto" 
marginBottom               "auto" 
marginLeft                 "auto" 
marginRight                "auto" 
marginTop                  "auto" 
maxHeight                  "none" 
maxWidth                   "none" 
minHeight                  "auto" 
minWidth                   "auto" 
overflow                   "visible" 
padding                    "0px" 
paddingBottom              "0px" 
paddingLeft                "0px" 
paddingRight               "0px" 
paddingTop                 "0px" 
pageBreakAfter             "auto" 
pageBreakBefore            "auto" 
position                   "static" 
right                      "auto" 
tableLayout                "auto" 
textAlign                  "left" 
textDecoration             "none" 
textIndent                 "0pt" 
textTransform              "none" 
top                        "auto" 
unicodeBidi                "normal" 
verticalAlign              "auto" 
visibility                 "inherit" 
whiteSpace                 "normal" 
width                      "auto" 
wordSpacing                "normal"


Any idea why setting a layout to <ul> modifies the bullet? 知道为什么设置布局到<ul>会修改子弹吗?
I thought it might be the margin/padding, but Firebug in IE is showing the same w/|w/o hasLayout. 我认为它可能是边距/填充,但IE中的Firebug显示相同的w / | w / o hasLayout。


Bare Page Example: 裸页示例:

   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
   <html>
   <head>
      <title>Default</title>
      <style type="text/css" media="all">ul {zoom:1;}</style>
   </head>
   <body>
      <ul>
         <li>foo</li>
         <li>bar</li>
         <li>foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
             foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
         </li>
      </ul>
   </body>
   </html>

Try the above in IE7 w/ and w/o the zoom:1 . 在IE7中尝试上面的w /和zoom:1
Note: because this deals with hasLayout other versions of IE are probably affected. 注意: 因为这涉及hasLayout其他版本的IE可能会受到影响。

I found: 我发现:

  • setting li {margin-left: 1em} does the trick 设置li {margin-left: 1em}就可以了
  • at {margin-left:9px} you'll start seeing the edge of the right edge of the bullet {margin-left:9px}你将开始看到子弹右边缘

Another interesting thing is that triggering the hasLayout on the list item ( <li> ), will force the bullet to the bottom of the text block. 另一个有趣的事情是在列表项( <li> )上触发hasLayout会强制子弹到文本块的底部。 Thus, if you're using something like *{zoom:1} , you'll need to vertically align your li at the top: li{vertical-align:top} 因此,如果您使用的是*{zoom:1} ,则需要在顶部垂直对齐lili{vertical-align:top}

Because of different bullet positions and sizes across browsers and browser versions I stopped using the default bullets and now replace them with an image. 由于浏览器和浏览器版本的子弹位置和大小不同,我停止使用默认项目符号,现在用图像替换它们。 This fixes all problems I had with bullets, and you can now easily change size, color and shape of the bullets. 这解决了我对子弹的所有问题,现在您可以轻松更改子弹的大小,颜色和形状。

ul{ 
    list-style-type: none;
    list-style-position: outside;
}
ul li{
    margin:0; 
    padding: 0 0 0 16px;
    background: url(bullet.gif) no-repeat left center;
}

For printing you can add a css file that uses the default bullets because images aren't always printed. 对于打印,您可以添加使用默认项目符号的css文件,因为并不总是打印图像。

This does not work for numbered lists ( <ol> ) so don't forget the ul css selector 这不适用于编号列表( <ol> ),所以不要忘记ul css选择器

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

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