【问题标题】:Scrollbar create margin in internet explorer滚动条在 Internet Explorer 中创建边距
【发布时间】:2019-09-22 23:40:44
【问题描述】:

所以我一直在用代码在 div 中进行简单的滚动

overflow: auto;

但是,我不知道为什么,但是当在 Internet Explorer 中打开时,滚动条会在右侧创建一个边距。它适用于 chrome 和 safari。

这是我处理的代码: HTML

     <div class="drag" id="second">
    <div class="dragheader" id="headerTwo">
      <p>Pre-story</p><div><a id="secondX" href="#">B</a></div></div>
      <div class="window" id="windowTwo">
        <p>
          It was a huge project for the planet earth.
          Humanity's first attempt to actively reach out to outer-space<br><br>
          : A 10year-mission to connect with other life forms and return to earth.
          Many Astronauts were involved in this project and on this spaceship, our spaceman X was born.
        </p>
        <div class="smallImg"><img src="img/baby.gif"/></div>
        <p class="cursor">
          However, as I said, our story started after this one ended.
          Every astronaut was killed by an unfortunate incident leaving young X all alone.<br>
          At that moment, our story begins.
        </p>
      </div>
  </div>

CSS

    .drag {
  position: absolute;
  z-index: 100;
  -webkit-animation: imgShadow 1.6s infinite;
  -o-animation: imgShadow 1.6s infinite;
  animation: imgShadow 1.6s infinite;
  border: #a481f1 3px solid;
  background: #000051;
  width: auto;
  display: none;
}
.dragheader {
  width: auto;
  height: 20px;
  background: #a481f1;
  z-index: 100;
  cursor: grab;
}
.dragheader p{
  float: right;
  margin-top: 0;
  margin-bottom: 0;
  margin-right: 1%;
  font-size: 16px;
  color: #00008b;
  font-weight: bolder;
  -webkit-animation: darkTextShadow 1.6s infinite;
  -o-animation: darkTextShadow 1.6s infinite;
  animation: darkTextShadow 1.6s infinite;
}
.dragheader div{
  float: left;
  margin-left: 1.4%;
}
.dragheader div a{
  -webkit-animation: darkTextShadow 1.6s infinite;
  -o-animation: darkTextShadow 1.6s infinite;
  animation: darkTextShadow 1.6s infinite;
  font-family: 'Untitled1', sans-serif;
  color: #00008b;
  font-size: 18px;
  text-decoration: none;
}
.window {
  width: 500px;
  height: 300px;
  z-index: 100;
  padding: 3%;
}
.window p{
  -webkit-animation: smallTextShadow 1.6s infinite;
  -o-animation: smallTextShadow 1.6s infinite;
  animation: smallTextShadow 1.6s infinite;
  margin: 0;
}
#first{
  -webkit-transform: translate(10%, 45%);
  -moz-transform: translate(10%, 45%);
  -ms-transform: translate(10%, 45%);
  -o-transform: translate(10%, 45%);
  transform: translate(10%, 45%);
}
#first .cursor{
  position: absolute;
  top: 0;
  margin-top: 8%;
  margin-right: 5%;
}
#second{
  -webkit-transform: translate(150%, 15%);
  -moz-transform: translate(100%, 15%);
  -ms-transform: translate(100%, 15%);
  -o-transform: translate(100%, 15%);
  transform: translate(250%, 15%);
}
#headerTwo{
  width: auto;
}
#windowTwo{
  max-width: 350px;
  height: 500px;
  overflow: auto;
  scrollbar-face-color:#2fccad;
  scrollbar-arrow-color:#2fccad;
  scrollbar-track-color:transparent;
  scrollbar-shadow-color:#2fccad;
  scrollbar-highlight-color:#2fccad;
  scrollbar-3dlight-color:#2fccad;
  scrollbar-darkshadow-Color:#2fccad;

}

#windowTwo img{
  width: 50%;
  display: inline-block;
}
.smallImg{
  position: relative;
  text-align: center;
  margin-bottom: 2%;
}

您可以在此处查看该网站: http://joie1234.github.io

我尝试了滚动填充和更改宽度参数,但没有任何效果...

感谢您的阅读;)

【问题讨论】:

    标签: html css internet-explorer scroll overflow


    【解决方案1】:

    检查下面的CSS(这只适用于IE浏览器10+),

    @media all and (-ms-high-contrast: none),
    (-ms-high-contrast: active) {
    #windowTwo {
       margin-right : -75px;
     }
    }
    

    【讨论】:

    • 非常感谢!我一直在为此苦苦挣扎;((
    猜你喜欢
    • 1970-01-01
    • 2010-09-20
    • 2012-05-23
    • 2010-10-14
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 1970-01-01
    • 2011-11-28
    相关资源
    最近更新 更多