JSFiddle - React, Tailwind, and code Playground

by ponyspy

HTML

<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
	<div class="flipper">
		<div class="front"> белое
			<!-- front content -->
		</div>
		<div class="back"> черное
			<!-- back content -->
		</div>
	</div>
</div>

CSS

/* entire container, keeps perspective */
.flip-container {
	perspective: 1000;
}
	/* flip the pane when hovered */
	.flip-container:hover .flipper, .flip-container.hover .flipper {
		-webkit-transform: rotateY(180deg);
	}

.flip-container, .front, .back {
	width: 320px;
	height: 480px;
}

.front {
    background: white;
    border: 1px solid black;
}

.back {
    background: black;
    color: white;
    border: 1px solid black;
}

/* flip speed goes here */
.flipper {
	-webkit-transition: 0.6s;
	-webkit-transform-style: preserve-3d;

	position: relative;
}

/* hide back of pane during swap */
.front, .back {
	-webkit-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);
}

/* back, initially hidden pane */
.back {
	-webkit-transform: rotateY(180deg);
}