gpt4 book ai didi

css - IE 忽略 a::before 上的绝对定位

转载 作者:行者123 更新时间:2023-11-28 12:13:30 25 4
gpt4 key购买 nike

用的是IE11,但是正在寻找IE9+的解决方案,我在调试为什么the labels at the bottom of this CSS bar chart are improperly positioned .

根据我对 IE 调试器的了解——尽管相对父容器具有确定的宽度和高度——position:absolute 未应用于 ::before 伪,导致标签位置奇怪:

.chart span::before {
position: absolute;
left: 0;
right: 0;
top: 100%;

在 Chrome、FF 等中一切正常:标签如预期的那样位于条形图下方。任何关于为什么会发生这种情况的见解,或关于在 IE 中调试::before 的任何提示(我不能像在 Chrome 和 FF 中那样定位::before)?

最佳答案

尝试在 ::before 伪元素上将 top:100% 替换为 bottom:-21px。这似乎适用于 FF、Chrome 和 IE9+。

Demo

关于css - IE 忽略 a::before 上的绝对定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26471678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com