<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.wrap {
position: relative;
width: 200px;
height: 100vh;
background: #ddd;
overflow: hidden;
}
span {
display: inline-block;
white-space: nowrap;
padding: 5px;
line-height: 24px;
cursor: pointer;
}
.title:hover {
animation: move 5s infinite alternate linear;
}
@keyframes move {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(calc(-100% + 200px), 0);
}
}
</style>
</head>
<body>
<div class="wrap">
<span class="title" title="超过定宽被挡住无法观看全部">超过定宽被挡住无法观看全部</span>
<span class="title" title="超过定宽被挡住无法观看全部">超过定宽被挡住无法观看全部</span>
<span class="" title="没超过定宽">没有超过定宽</span>
<span class="title" title="超过定宽被挡住无法观看全部">超过定宽被挡住无法观看全部</span>
</div>
</body>
</html>
超出定宽的文本,鼠标悬浮,可以从左到右滑动