gpt4 book ai didi

css - IE9背景显示在边框右侧

转载 作者:太空宇宙 更新时间:2023-11-04 04:57:27 24 4
gpt4 key购买 nike

我有一个带有 background-color 和 3 像素白色边框的 div。

当我将 html 元素设置为 direction:rtloverflow-y: scroll 时,我得到了背景的像素边界右侧 - 仅在 IE9 中:

enter image description here

我将我的代码粘贴在这里,因为在 JsFiddle 上我无法复制该错误。

<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
html {
overflow-y: scroll;
direction:rtl;
}
.main {
margin: 0 auto;
width: 960px;
}
.sld-menu-item {
height: 85px;
border: 3px solid #fff;
background-color: #d25188;
}
</style>
</head>
<body>
<div class="main" role="main">
<div class="sld-menu-item sld-menu-item-2">
</div>
</div>
</body>

有没有人遇到过这个问题,和/或有人可以提出解决方案吗?我不能放弃 scroll 和 rtl 规则...

最佳答案

我只能通过设置 overflow: hidden on containing element 并进行 negative margin hack 来修复它:

.main {
overflow: hidden;
}
.sld-menu-item {
margin-right: -1px;
}

您可能还想将 sld-menu-item 的宽度设置为 961px。可以把它放在 IE9 条件语句中。不过,我希望有更好的方法来解决这个问题。

关于css - IE9背景显示在边框右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12128078/

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