html - 向上滑动内容不正常

标签 html css

我是 html 和 css 的新手。试图在我的网页中制作一部分,我希望一些图像和文本并排向上滑动。我为此使用了 html 和 css。

这是 JSFIDDLE 中代码的链接:

Sliding up code

    /* Chrome, Safari, Opera */ 
    @-webkit-keyframes mymove {
        0% { top: 0%; }
        20% { top: -0%; }
        25% { top: -20%; }
        45% { top: -25%; }
        50% { top: -45%; }
        70% { top: -50%; }
        75% { top: -70%; }
        95% { top: -75%; }
        100% { top: -100%; }
    }

    /* Standard syntax */
    @keyframes mymove {
        0% { top: 0%; }
        20% { top: -0%; }
        25% { top: -20%; }
        45% { top: -25%; }
        50% { top: -45%; }
        70% { top: -50%; }
        75% { top: -70%; }
        95% { top: -75%; }
        100% { top: -100%; }
    }

实际上它只向上滑动图像而不显示文本。但我两者都需要。

最佳答案

请检查更新后的代码。现在它工作正常。

#image_slider_right {
  background-color: #CCFF00;
  width: 50%;
  float: left;
  height: 250px;
  margin: 50px 0 0 50px;
}
/* Chrome, Safari, Opera */

@-webkit-keyframes mymove {
  0% {
    top: 0%;
  }
  20% {
    top: -0%;
  }
  25% {
    top: -20%;
  }
  45% {
    top: -25%;
  }
  50% {
    top: -45%;
  }
  70% {
    top: -50%;
  }
  75% {
    top: -70%;
  }
  95% {
    top: -75%;
  }
  100% {
    top: -100%;
  }
}
/* Standard syntax */

@keyframes mymove {
  0% {
    top: 0%;
  }
  20% {
    top: -0%;
  }
  25% {
    top: -20%;
  }
  45% {
    top: -25%;
  }
  50% {
    top: -45%;
  }
  70% {
    top: -50%;
  }
  75% {
    top: -70%;
  }
  95% {
    top: -75%;
  }
  100% {
    top: -100%;
  }
}
div#sliderup {
  overflow: hidden;
  position: relative;
  height: 100%;
  margin-left: 10px;
  width: 98%;
}
div#sliderup figure .img_up {
  width: 98%;
  height: 100%;
  float: left;
  margin-bottom: 10px;
  position: relative;
}
div#sliderup figure {
  position: relative;
  width: 98%;
  margin: 0;
  text-align: left;
  animation: 20s mymove infinite;
}
.divimgslideup {
  float: left;
  width: 50%;
}
.divimgslideup_txt {
  float: left;
  width: 50%;
}
<div id="image_slider_right">

  <div id="sliderup">
    <figure>
      <div class="img_up">
        <div class="divimgslideup">
          <img src="http://php.quicoto.com/wp-content/uploads/2013/06/css3.jpg" alt="" height="100px" width="100px">
        </div>

        <div class="divimgslideup_txt">
          <strong>Make the Best Choice</strong>
          <p>With 17 unique 1, 2 & 3 bedroom floor plans available, tap to find the</p>
        </div>
      </div>

      <div class="img_up">
        <div class="divimgslideup">
          <img src="http://php.quicoto.com/wp-content/uploads/2013/06/css3.jpg" alt="" height="100px" width="100px">
        </div>

        <div class="divimgslideup_txt">
          <strong>Get Comfortable</strong>
          <p>Quality and exceptional value are foundations of our philosophy. Satisfaction with your home is our</p>
        </div>
      </div>

      <figure>
  </div>
</div>

</div>

检查 JSFIDDLE 上的工作代码

关于html - 向上滑动内容不正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30761273/

相关文章:

javascript 表格单元格显示在 IE 和 Firefox 中有效,但在 Chrome 和 Safari 中无效

javascript 如何在任何事件上加载脚本或数据(如谷歌)而不使用ajax

javascript - 在 jQuery UI 对话框中动态加载本地 HTML 文件

javascript - html 上的 Fancybox

html - 使用 css3 像书一样旋转图像

html - CSS 位置固定在顶部,带有水平和垂直滚动条

javascript - 使div粘在容器div的底部

html - 背景图像上的图像闪烁

php - 在 javascript/HTML5 应用程序之外获取变量

jquery - 单击按钮时显示 "loading"动画