要滚动的页面,滚动条不占据空间,当我们把鼠标悬浮在滚动页面上面的时候,滚动条出现。

  <style>
  .box {
    width: 350px;
    overflow: hidden;  /* 父元素hidden */
    height: 650px;
    box-shadow: 0 0 5px rgba(93, 96, 93, 0.5);
  }
  .box:hover {
    overflow: overlay; /* 当hover效果的时候,滚动条出现 */
  }
  .box .item {
	width: 300px;
	height: 200px;
  }
  img {
   width: 100%;
   height: 100%;
  }
  </style>
  <div class="box">
    <div class="item">
      <img src="https://n.sinaimg.cn/sinacn20119/548/w1322h826/20190408/3862-hvhrcxn2259616.jpg" alt="">
    </div>
    <div class="item">
      <img src="https://n.sinaimg.cn/sinacn20119/548/w1322h826/20190408/3862-hvhrcxn2259616.jpg" alt="">
    </div>
	<div class="item">
      <img src="https://n.sinaimg.cn/sinacn20119/548/w1322h826/20190408/3862-hvhrcxn2259616.jpg" alt="">
    </div>
	<div class="item">
      <img src="https://n.sinaimg.cn/sinacn20119/548/w1322h826/20190408/3862-hvhrcxn2259616.jpg" alt="">
    </div>
  </div>

一段可滚动的文字

<!doctype html>  
<html>  
<head>  
<title>LOOP</title>  
<style>  
@keyframes loop {  
	0% {  
		transform: translateX(0);  
	}  
	100% {  
		transform: translateX(-100%);  
	}  
}  
  
.box {  
	white-space: nowrap;  
}  
  
.scrollDiv {  
	width: 600px;  
	display: inline-block;  
	text-align: center;  
	animation: loop 2s linear infinite;  
}  
</style>  
</head>  
<body>  
<div class="box">  
	<div class="scrollDiv">  
		这是一段可以滚动的文本  
	</div>  
</div>  
</body>  
  
</html>  
  

10-09 15:34