【问题标题】:absolute positioning within relative list item elements in ie6ie6中相对列表项元素内的绝对定位
【发布时间】:2011-07-04 22:06:07
【问题描述】:

这让我发疯:

<ul>  
   <li style="position:relative;border:1px solid green">  
      <p>some content...</p>  
      <p>some content...</p>  
      <a style="position:absolute; left:0; top:0; width:100%; height:100%; background:red; display:block">a mask over whole list item</a>  
   </li>  
</ul>

我以各种形式遇到过这个问题(例如定位角图形、尝试在列表项上创建蒙版等)

无论我尝试什么,我都无法让 ie6 绝对定位列表项中的元素。另一个例子:

<ul>  
   <li style="position:relative;border:1px solid green">  
      <p>some content...</p>  
      <p>some content...</p>  
      <div style="position:absolute; left:0; top:0; width:20px; height:20px; background:red; display:block"></div>  
      <div style="position:absolute; right:0; top:0; width:20px; height:20px; background:green; display:block"></div>  
      <div style="position:absolute; left:0; bottom:0; width:20px; height:20px; background:blue; display:block"></div>  
      <div style="position:absolute; right:0; bottom:0; width:20px; height:20px; background:yellow; display:block"></div>  
   </li>  
</ul>

【问题讨论】:

  • 您是否在怪癖模式下运行?你的文档类型是什么?
  • 嗨 MP,仅供参考,您可以使用 CTRL-K 缩进整个代码块并保留格式 - 或手动将代码缩进至少 4 个空格,它将被正确处理。

标签: internet-explorer-6 css-position


【解决方案1】:

当我添加属性时它与 IE6 一起工作

zoom: 1; 

到 ul 元素。我不知道为什么会这样。

【讨论】:

    猜你喜欢
    • 2019-06-22
    • 1970-01-01
    • 1970-01-01
    • 2017-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多