对齐美国国旗星形模式中的div?

时间:2017-06-05 19:31:26

标签: html css

我正在制作网站的一部分,其中顶行有3个居中的项目,底行有两个居中的项目。我希望它们像美国国旗上的星星一样对齐。

body {
  background-color: #eee;
}


/* ----------------------------- FLIP CIRCLES ----------------------------- */


/* entire container, keeps perspective */

.flip-container {
  perspective: 1000px;
}


/* flip the pane when hovered */

.flip-container:hover .flipper {
  transform: rotateY(180deg);
}

.flip-container,
.flipping-front,
.flipping-back {
  width: 300px;
  height: 300px;
  display: inline-block;
}


/* flip speed goes here */

.flipper {
  transition: 0.6s;
  transform-style: preserve-3d;
  position: relative;
}


/* hide back of pane during swap */

.flipping-front,
.flipping-back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
}


/* front pane, placed above back */

.flipping-front {
  z-index: 2;
  transform: rotateY(0deg);
  /* for firefox 31 */
}


/* back, initially hidden pane */

.flipping-back {
  transform: rotateY(180deg);
}

.flipper img {
  -webkit-border-radius: 100%;
  -moz-border-radius: 100%;
  border-radius: 100%;
}
<!-- START FLIP BLOCK -->
<div style="margin: auto; display: flex">

  <div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
    <div class="flipper">
      <div class="flipping-front">
        <!-- front content -->
        <img src="img/flip/front.jpg" width="300" />
      </div>
      <div class="flipping-back">
        <!-- back content -->
        <img src="img/flip/back.png" width="300" />
      </div>
    </div>
  </div>

  <div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
    <div class="flipper">
      <div class="flipping-front">
        <!-- front content -->
        <img src="img/flip/front.jpg" width="300" />
      </div>
      <div class="flipping-back">
        <!-- back content -->
        <img src="img/flip/back.png" width="300" />
      </div>
    </div>
  </div>

  <div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
    <div class="flipper">
      <div class="flipping-front">
        <!-- front content -->
        <img src="img/flip/front.jpg" width="300" />
      </div>
      <div class="flipping-back">
        <!-- back content -->
        <img src="img/flip/back.png" width="300" />
      </div>
    </div>
  </div>
</div>

<!-- START FLIP BLOCK: ROW 2 -->
<div style="margin: auto; display: flex">
  <div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
    <div class="flipper">
      <div class="flipping-front">
        <!-- front content -->
        <img src="img/flip/front.jpg" width="300" />
      </div>
      <div class="flipping-back">
        <!-- back content -->
        <img src="img/flip/back.png" width="300" />
      </div>
    </div>
  </div>

  <div class="flip-container" ontouchstart="this.classList.toggle('hover');" style="margin: auto">
    <div class="flipper">
      <div class="flipping-front">
        <!-- front content -->
        <img src="img/flip/front.jpg" width="300" />
      </div>
      <div class="flipping-back">
        <!-- back content -->
        <img src="img/flip/back.png" width="300" />
      </div>
    </div>
  </div>
</div>

0 个答案:

没有答案