Лучший способ решить эту проблему - использовать единицы viweport.
Используя vmin, вы всегда будете видеть куб, оставляя пустое пространство в большем измерении viweport.
Если выесли хотите наоборот, вы можете использовать vmax (замените все вхождения vmin на vmax).
.three-d-container {
width: 100%;
height: 100vh;
border-radius: 3px;
position: relative;
perspective: 230px;
}
.three-d-cube {
width: 100vmin;
height: 100vmin;
position: absolute;
transition: transform 1s;
transform-style: preserve-3d;
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg);
left: 0;
right: 0;
margin: auto;
}
.three-d-cube .three-d-item {
width: 100%;
height: 100%;
display: block;
margin: 0;
position: absolute;
}
.three-d-cube .three-d-item img {
width: 100%;
height: 100%;
display: block;
margin: 0;
}
.three-d-item:nth-child(1) {
transform: rotateY(90deg) translateX(50vmin) rotateY(90deg);
}
.three-d-item:nth-child(2) {
transform: translateX(50vmin) rotateY(-90deg);
}
.three-d-item:nth-child(3) {
transform: translateX(-50vmin) rotateY(90deg);
}
.three-d-item:nth-child(4) {
transform: translateY(50vmin) rotateX(-90deg);
}
.three-d-item:nth-child(5) {
transform: translateY(-50vmin) rotateX( 90deg);
}
.three-d-item:nth-child(6) {
transform: rotateY(90deg) translateX(-50vmin) rotateY(90deg);
}
.a:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg);
}
.b:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg) rotateX(90deg);
}
.c:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg) rotateX(-90deg);
}
.d:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg) rotateY(90deg);
}
.e:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg) rotateY(-90deg);
}
.f:checked~.three-d-cube {
transform: rotateY(90deg) translateX(50vmin) rotateY(-90deg) rotateY(180deg);
}
.three-d-bullet {
float: left;
}
<section class="three-d-container">
<input type="radio" checked class="three-d-bullet a" name="three-d">
<input type="radio" class="three-d-bullet b" name="three-d">
<input type="radio" class="three-d-bullet c" name="three-d">
<input type="radio" class="three-d-bullet d" name="three-d">
<input type="radio" class="three-d-bullet e" name="three-d">
<input type="radio" class="three-d-bullet f" name="three-d">
<div class="three-d-cube">
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/1" alt="">
</figure>
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/2" alt="">
</figure>
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/3" alt="">
</figure>
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/4" alt="">
</figure>
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/5" alt="">
</figure>
<figure class="three-d-item">
<img src="http://lorempixel.com/500/500/food/6" alt="">
</figure>
</div>
</section>