当我用鼠标将div悬停时,悬停函数并没有应用它的效果,而是在打开/刷新.html文件时立即发生,并且悬停它没有任何效果。代码和工作悬停函数是一样的,我不明白为什么它在我悬停时不能工作,而是在页面刷新时工作。
有什么建议吗?
下面是HTML:
(...)<div class="firstInbetween">
        <div class="insideInbetween" style="cursor: pointer">
            <p>TRADE</p>
        </div>
    </div> (...)下面是CSS:
.insideInbetween {
  background: #5D7075;
  width: 60px;
  font-family: 'Open Sans';
  font-size: 20px;
  text-align: center;
  border: 2px solid red;
  padding: 25px;
  margin: auto;
  margin-top: 50px;
  color: #333333;
  -o-transition: background 0.5s linear;
  -moz-transition: background 0.5s linear;
  -khtml-transition: background 0.5s linear;
  -webkit-transition: background 0.5s linear;
  -ms-transition: background 0.5s linear;
  transition: background 0.5s linear;
}
.insideInbetween:hover {
  background: #b50000;
}提前感谢!
编辑:这是完整的文件,您可以查看它:https://jsfiddle.net/arxs6b66/
发布于 2016-11-06 00:15:04
.insideInbetween {
  background: #5D7075;
  width: 60px;
  font-family: 'Open Sans';
  font-size: 20px;
  text-align: center;
  border: 2px solid red;
  padding: 25px;
  margin: auto;
  margin-top: 50px;
  color: #333333;
  -o-transition: background 0.5s linear;
  -moz-transition: background 0.5s linear;
  -khtml-transition: background 0.5s linear;
  -webkit-transition: background 0.5s linear;
  -ms-transition: background 0.5s linear;
  transition: background 0.5s linear;
}
} /* <-- DELETE THIS*/
.insideInbetween:hover {
  background: #b50000;
}
.secondInside {
  background-color: #123189;
  color: white;
  width: 35%;
  float: left;
  height: 500px;
  margin: 2%;
}
在完整的jds中有一个{在悬停之前,只要删除它,它就能工作了。
https://stackoverflow.com/questions/40444309
复制相似问题