css - 如何制作CSS文本溢出动画

标签 css

我现在有这个http://codepen.io/capraruioan/pen/dXyyMp

.parent
  position: relative
  width: 300px
  border: 1px solid black
  margin-left: 40%
  height: 20px
  .child
    position: absolute
    min-width: 100%
    white-space: nowrap
    animation-name: bounceText
    animation-duration: 5s
    animation-direction: alternate
    animation-iteration-count: infinite
    animation-timing-function: linear
@keyframes bounceText {
    0% {
        left: 0
    }
    100% {
    right: 0%
      // left: -100%
    }
}   

只有当宽度 > 100% 时,我才希望文本从左向右跳动

这就是我设置 min-height: 100% 的原因 理想的情况是从左:0 弹跳到右:0。但是如果我那样做就没有动画了..

我可以只使用 CSS 来实现吗?我不想使用 jquery

最佳答案

我不太明白你在问什么,但也许是这样的?

.parent
  position: relative
  width: 450px
  border: 1px solid black
  margin-left: 34%
  height: 20px
  .child
    display: block
    position: absolute
    min-width: 100%
    white-space: nowrap
    animation-name: bounceText
    animation-duration: 2s
    animation-direction: alternate
    animation-iteration-count: infinite
    animation-timing-function: linear
@keyframes bounceText {
    0% {
        left: 0%
    }
    100% {
    left: 18%

    }
}   

关于css - 如何制作CSS文本溢出动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37484150/

相关文章:

css - 将 Rmarkdown 与来自 CDN 的 CSS 结合使用

css - Mac 浏览器的兼容性问题

javascript - 为什么::before 伪元素在移动菜单上位于顶部?

javascript - 如何使用某个 src url 查找 img 并使用 vanilla javascript 更改 css?

html - IE10随机图像渲染问题

javascript - 如何在页面加载时禁用 Anchor(a ) 标记或(默认情况下禁用)并使用 jquery 或 Javascript 启用它?

javascript - 在 jquery tablesorter 插件中排序时,始终将具有特定值的行保留在底部

jquery - 悬停时发光的文字

css - @media 不适用于 firefox 和 IE

css - 菜单下拉菜单 - 我有一个 MooTools 示例,但我怎样才能使它成为纯 CSS?