logo

Backgrounds

Arc-en-ciel

HTML :

<div class="myGrad"></div>

CSS :

/* 
Attention, si vous augmentez la hauteur de la div myGrad, alors il faudra aussi augmenter la hauteur de myGrad:after
*/

body {
  font-size: 2em;
  color: #FFF;
  text-align: center;
}

html{
  background-color: #34495e;
}
/* main */
/* mixin */
.myGrad {
  width: 100%;
  height: 50vh;
  margin: 20px 0;
  border-top: solid 10px #FFF;
  border-bottom: solid 10px #FFF;
  overflow: hidden;
}
.myGrad:after {
  position: relative;
  content: "";
  display: block;
  top: 0;
  left: 0;
  width: 100%;
  height: 250vh;
  background: linear-gradient(0% -15%, #655bef 0%, #fa28bf 20%, #ff4665 40%, #fbde4e 60%, #00fbea 80%, #555def 100%);
  background: -moz-linear-gradient(0% -15%, #655bef 0%, #fa28bf 20%, #ff4665 40%, #fbde4e 60%, #00fbea 80%, #555def 100%);
  background: -webkit-gradient(linear, 0% -15%, 100% 100%, color-stop(0, #655bef), color-stop(0.2, #fa28bf), color-stop(0.4, #ff4665), color-stop(0.6, #fbde4e), color-stop(0.8, #00fbea), color-stop(1, #555def));
  -o-animation: anime 17.5s infinite;
  -ms-animation: anime 17.5s infinite;
  -moz-animation: anime 17.5s infinite;
  -webkit-animation: anime 17.5s infinite;
}

@-webkit-keyframes anime {
  0% {
    top: 0;
  }
  50% {
    top: -1800px;
  }
  100% {
    top: 0;
  }
}
@keyframes anime {
  0% {
    top: 0;
  }
  50% {
    top: -1800px;
  }
  100% {
    top: 0;
  }
}

HTML :

<section class="background_container">
  <div class='background_animation'>
  </div>
  <div class='text'>
      <figure>
        <svg id="Calque_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 301.1 185.2">
          <style>.st0{fill:#1e1e1c}</style>
      </svg>
  </figure>
</div>
</section>

CSS :

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
.background_container {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.background_animation {
  -webkit-animation: 40s linear infinite background_animation;
          animation: 40s linear infinite background_animation;
  width: calc(100% + 511px);
  height: calc(100% + 849px);
  background-image: url("img/pat1.jpg");
  -webkit-transform: translate3d(-511px, -849px, 0);
          transform: translate3d(-511px, -849px, 0);
}
@-webkit-keyframes background_animation {
  100% {
    -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
  }
}
@keyframes background_animation {
  100% {
    -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
  }
}
.text {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  padding: 10vmin;


}



						  


	

Une idée ? Partagez-la !

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *