div块在CSS中的位置

时间:2018-11-30 09:55:20

标签: html css

中间有4个块和一个动画,在动画的右侧有2个块,在左侧有2个块。需要在左侧创建2个块,在右侧创建2个块,但是现在我只有2个块。如何将其拆分为两个块,左边有2个,右边有2个?

这是代码段:

.div-wrap {
  display: flex;
  align-items: center;
  flex-flow: column nowrap;
  justify-content: space-between;
  text-align: center;
}

:root {
  --time: 24;
}

.div-txt p.label {
  color: #0065de;
  font: bold 16px 'Arial';
  animation-duration: calc(var(--time) * 1s);
  animation-iteration-count: infinite;
  animation-name: color-change;
}

.div-txt:nth-child(1) p.label {
  animation-delay: 0s;
}

.div-txt:nth-child(2) p.label {
  animation-delay: calc(var(--time) / 4 * 1s);
}

.div-txt:nth-child(4) p.label {
  animation-delay: calc(var(--time) / 2 * 1s);
}

.div-txt:nth-child(5) p.label {
  animation-delay: calc(var(--time) / 1.33 * 1s);
}

.div-img {
  position: relative;
  height: 600px;
  width: 600px;
  /*  border: 2px solid #ccc;*/
  /*  background: radial-gradient(ellipse at center, rgba(153,153,153,1) 0%,rgba(0,0,0,1) 100%);*/
}

.div-img img {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  transform: translateX(-50%);
  opacity: 0;
  animation-duration: calc(var(--time) * 1s);
  animation-iteration-count: infinite;
  animation-name: fade;
}

.div-img img:nth-child(1) {
  animation-delay: 0s;
}

.div-img img:nth-child(2) {
  animation-delay: calc(var(--time) / 8 * 1s);
}

.div-img img:nth-child(3) {
  animation-delay: calc(var(--time) / 4 * 1s);
}

.div-img img:nth-child(4) {
  animation-delay: calc(var(--time) / 2.66 * 1s);
}

.div-img img:nth-child(5) {
  animation-delay: calc(var(--time) / 2 * 1s);
}

.div-img img:nth-child(6) {
  animation-delay: calc(var(--time) / 1.6 * 1s);
}

.div-img img:nth-child(7) {
  animation-delay: calc(var(--time) / 1.33 * 1s);
}

.div-img img:nth-child(8) {
  animation-delay: calc(var(--time) / 1.14 * 1s);
}

.div-txt {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
  width: 300px;
  margin: 0 auto;
}

@keyframes color-change {
  0%,
  25%,
  100% {
    color: black;
  }
  1%,
  24% {
    color: #ED5F8A;
  }
}

@keyframes fade {
  0%,
  20%,
  100% {
    opacity: 0;
    z-index: auto;
  }
  1%,
  99% {
    z-index: 1;
  }
  8%,
  12% {
    opacity: 1;
  }
}

@media all and (min-width: 1170px) {
  .div-wrap {
    flex-flow: row nowrap;
    justify-content: space-around;
  }
}

@media all and (max-width: 600px) {
  .div-img {
    max-width: 100%;
  }
}

body {
  margin: 0;
}
<div class="div-wrap">
  <div class="div-txt">

    <img src="img/connect.svg" style="width: 36px; height: 36px;">
    <p class="label" style="margin-top: 5px;">Connect</p>
    <p>on the shoulders, <br>turn on it and connect application <br>with device.</p>
  </div>
  <div class="div-txt">
    <img src="img/calibrate.svg" style="width: 36px; height: 36px;">
    <p class="label" style="margin-top: 5px;">Calibrate</p>
    <p>set up calibration to <br>help device remember your upright <br>and slouch positions.</p>
  </div>



  <div class="div-img">
    <img src="http://ipic.su/img/img7/fs/840439f8065b63cde3b6c72.1543563582.png" title="Image 1">
    <img src="http://ipic.su/img/img7/fs/AMS.1543563615.jpg" title="Image 2">
    <img src="http://ipic.su/img/img7/fs/Avatar.1543563644.png" title="Image 3">
    <img src="http://ipic.su/img/img7/fs/Image-0.1543563682.jpg" title="Image 4">
    <img src="http://ipic.su/img/img7/fs/Roundel_of_the_Kantangan_Air_Force.1543563707.png" title="Image 5">
    <img src="http://ipic.su/img/img7/fs/Shtandart_pmr.1543563777.jpg" title="Image 6">
    <img src="http://ipic.su/img/img7/fs/X_a01840d5.1543563829.jpg" title="Image 7">
    <img src="http://ipic.su/img/img7/fs/Mishka_satanist.1543563883.png" title="Image 8">
  </div>
  <div class="div-txt" style="">

    <img src="img/train.svg" style="width: 36px; height: 36px;">
    <p class="label" style="color: #0065de;">Train</p>
    <p>posture anytime you want, <br>set up daily goal to improve gradually <br>your posture.</p>



  </div>
  <div class="div-txt">
    <img src="img/analyze.svg" style="width: 36px; height: 36px;">
    <p class="label" style="margin-top: 5px;">Analyze</p>
    <p>Statistics let you track and analyze the <br>progress you’ve made from first <br>training to the last.</p>
  </div>
</div>

此处图片的尺寸较大,应为600x600px。请对此事提供帮助。

0 个答案:

没有答案