I have a quite specific CSS question. I have made a turn/flip-card functionality in HTML and CSS.
I have one div(container), which is wrapping two overlaying elements. Sometimes, depends on the content, the one element is larger than the other. How can I make the height of the container vary from which element is currently in the foreground?
I have made a Codepen as a working space for this question. Please note that the back-card has twice the content as front-card. I have a quite specific CSS question. I have made a turn/flip-card functionality in HTML and CSS.
I have one div(container), which is wrapping two overlaying elements. Sometimes, depends on the content, the one element is larger than the other. How can I make the height of the container vary from which element is currently in the foreground?
I have made a Codepen as a working space for this question. Please note that the back-card has twice the content as front-card.
http://codepen.io/Froelund/pen/gppBvX
.flip-container {
  -webkit-perspective: 1000;
  -moz-perspective: 1000;
  -o-perspective: 1000;
  perspective: 1000;
}
.flip-container.flip .flipper {
  -webkit-transform: rotateY(-180deg);
  -moz-transform: rotateY(-180deg);
  -o-transform: rotateY(-180deg);
  -ms-transform: rotateY(-180deg);
  transform: rotateY(-180deg);
}
.flip-container,
.front,
.back {
  margin-bottom: 40px;
  width: 100%;
  height: 180px;
  text-align: center;
}
.flip-container .top,
.front .top,
.back .top {
  padding: 30px 20px;
}
.flip-container .top,
.flip-container .icon-holder,
.front .top,
.front .icon-holder,
.back .top,
.back .icon-holder {
  background-color: #777777;
  color: #fff;
}
.flip-container .icon-holder,
.front .icon-holder,
.back .icon-holder {
  margin: -25px auto 0;
  border-radius: 50%;
  border: 6px solid #fff;
  width: 50px;
  height: 50px;
  padding: 7px 10px 10px;
  font-size: x-large;
}
.front.success .top,
.front.success .icon-holder,
.back.success .top,
.back.success .icon-holder {
  background-color: #23AE89;
  color: #fff;
}
/* flip speed goes here */
.flipper {
  transition: 0.6s;
  -webkit-transition: 0.6s;
  -moz-transition: 0.6s;
  -o-transition: 0.6s;
  -ms-transition: 0.6s;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  position: relative;
}
/* hide back of pane during swap */
.front,
.back {
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
}
/* front pane, placed above back */
.front {
  z-index: 2;
  /* for firefox 31 */
  -webkit-transform: rotateY(0deg);
  -moz-transform: rotateY(0deg);
  -o-transform: rotateY(0deg);
  -ms-transform: rotateY(0deg);
  transform: rotateY(0deg);
}
/* back, initially hidden pane */
.back {
  -webkit-transform: rotateY(180deg);
  -moz-transform: rotateY(180deg);
  -o-transform: rotateY(180deg);
  transform: rotateY(180deg);
}
