【问题标题】:Weird position absolute chrome bug奇怪的位置绝对铬错误
【发布时间】:2013-03-30 06:25:20
【问题描述】:

我绝对是在浮动 div 中定位元素。在我们调整窗口大小之前,最后一个绝对定位的元素会一直停留在 div 的顶部(参见here

到目前为止我尝试过的事情:

  • 在浮动元素中放置一个容器
  • 溢出:隐藏/自动到浮动、元素和容器

这只发生在 chrome 中。知道为什么/发生了什么吗?

【问题讨论】:

  • Chrome 和操作系统版本?
  • Chrome 版本 26.0.1410.43,操作系统:Ubuntu 12.04、12.10 和 Mac OS X 10.8.3
  • 看不到你在说哪个元素。在 Win7 上使用 Chrome 26。你能描述(打印屏幕)有问题的元素吗...
  • 您是否有机会提供您的 javascript 的未缩小版本?过去我在 webkit 中遇到过类似的问题,其中元素的位置已关闭,但所有 css 定位规则都被正确遵循。那时我通过在需要显示元素时强制重绘来“修复”它,但我有兴趣尝试找到解决此问题的适当方法。

标签: html css google-chrome css-position


【解决方案1】:

您只需做一些小事,其他一切都很棒。使用这个

.schedule-course-slot-wrapper {
position: absolute; /*Important*/
border: thin solid;
border-radius: 3px;
margin: 0 2px;
padding: 0 3px;
height: 100%;
}

改为

.schedule-course-slot-wrapper {
position: relative; /*Important*/
border: thin solid;
border-radius: 3px;
margin: 0 2px;
padding: 0 3px;
height: 100%;
}

【讨论】:

  • 这成功了!谢啦。你知道它为什么会这样吗?
【解决方案2】:

你必须使用

pop.style.left = l+"px";
pop.style.top = t+"px";

而不是

pop.style.posLeft = l;
pop.style.posTop = t;

或两者兼而有之。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-17
    • 2015-09-16
    • 1970-01-01
    • 2010-10-28
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    相关资源
    最近更新 更多