具有无限动画的CSS伪元素溢出主体

问题描述

我正在尝试使用随CSS动画向下移动的CSS伪元素文本创建漂亮的背景。除了文字一旦到达正文的底部,它会继续前进并使页面的整体高度变长之外,它的工作效果非常好。我希望我的文字继续显示下来,并在页面末尾隐藏起来。

.bgquote1 {
  position: relative;
}


.bgquote1::after {
  content:
  "I don't aim for perfection. But I do want to try and\A come up with something interesting. -Kate Bush";
  font-family: "Palatino";
  top: 10000px;
  left: 20px;
  transform: rotate(-90deg);
  z-index: -1;
  white-space: pre-wrap;
  animation: nudge2 5900s linear infinite alternate;
  position: absolute;
}

https://jsfiddle.net/p6wmeftg/1/

请在示例中查看底部的文本,这些文本会不断下降,从而使页面变长,不再显示任何内容

解决方法

将此样式添加到您的.quotewrapper类中,并确保您的htmlbody具有position:relative并且没有固定高度:

html,body {
  position: relative;
  height: auto;
}
.quotewrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

Your edited JSFiddle

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...