CSS缩放背景bug

时间:2013-08-23 17:34:46

标签: html css animation background

我希望云背景在框内缩放。这可能吗?

目前看起来像这样:http://freecns.yanlu.de/cumulus1/

不知何故,背景甚至在有限的盒子上也会缩放。我已经尝试了几种方法来解决它,但我找不到这个bug。我不确定是否有可能做这样的事情。

我使用了以下 HTML

<div class="backgroundbox">
    <div class="box_animation"></div>
    <ul class="nostyle inline center">
        <li class="bboxcontent left">Freecns Cumulus includes over 100 weather specific icons which are shipped as PNG, PDF, EPS and SVG. <br /></li>
        <li class="bboxvideo"></li>
    </ul>
</div>

CSS

.backgroundbox {
  position: relative;
  z-index: 0;
  height: 295px;
  width: 816px;
  border-radius: 16px;
  margin-top: 48px;
  margin-left: auto;
  margin-right: auto;
  background: url('http://www.yanlu.de/files/images/CloudBG.png') no-repeat center;
  padding-top: 81px;
}
.bboxcontent {
  width: 295px;
  font-family: HelveticaNeue-Light;
  font-size: 18px;
  color: #FFFFFF;
  line-height: 22px;
  text-shadow: 0px 1px 2px rgba(0,0,0,0.75);
  margin-right: 8px;
  display: table-cell;
  vertical-align: middle;
}
.bboxvideo {
  height: 214px;
  border-radius: 4px;
  border: 4px solid #FFFFFF;
  color: #FFFFFF;
  -moz-box-shadow:    0px 1px 2px 0px rgba(0,0,0,0.75);
  -webkit-box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.75);
  box-shadow:         0px 1px 2px 0px rgba(0,0,0,0.75);
  margin-left: 8px;

  display: table-cell;
  vertical-align: middle;
}
.box_animation {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: url('http://www.yanlu.de/files/images/CloudBG.png');
  -webkit-background-size: cover;
  -webkit-transition-property: -webkit-transform;
  -webkit-animation-name: scale; 
  -webkit-animation-duration: 40s; 
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-timing-function: linear;
}

1 个答案:

答案 0 :(得分:1)

如果我了解您的问题,您可以为overflow: hidden;设置.backgroundbox,它会将其捕捉到您的大小