我正在研究这个标签模型并遇到了一些问题。我只是通过标签模型,发现这很有趣。但我发现只有三个选项卡。所以,据我所知,我已经添加了第四个选项卡的代码,但它没有显示。旋转有一些错误估计。
.perspective {
perspective: 76em;
perspective-origin: 50% 50px;
width: 494px;
margin: 0 auto;
font-family: 'Roboto', sans-serif;
font-weight: 100;
color: #fff;
text-align: center;
}
input {
display: none;
}
.tab {
position: absolute;
width: 60px;
height: 47px;
background: pink;
right: 10px;
line-height: 47px;
font-weight: 300;
}
.tab:nth-child(1) {
top: -5px;
background: #06d6a0;
}
.tab:nth-child(2) {
top: 53px;
background: #1b9aaa;
}
.tab:nth-child(3) {
top: 112px;
background: #ef476f;
}
.tab:nth-child(4) {
top: 170px;
background: GREEN;
}
.cube {
position: relative;
margin: 60px auto 0;
width: 300px;
height: 200px;
transform-origin: 0 100px;
transform-style: preserve-3d;
transition: transform 0.5s ease-in;
}
.tab-content {
width: 300px;
height: 200px;
position: absolute;
}
.tab-content h1 {
font-size: 25px;
margin: 75px 0 10px;
font-weight: 300;
}
.tab-content p {
font-size: 12px;
}
.tab-content:nth-child(1) {
transform: rotateX(-270deg) translateY(-100px);
transform-origin: top left;
background: #06d6a0;
}
.tab-content:nth-child(2) {
transform: translateZ(100px);
background: #1b9aaa;
}
.tab-content:nth-child(3) {
transform: rotateX(-90deg) translateY(100px);
transform-origin: bottom center;
background: #ef476f;
}
.tab-content:nth-child(4) {
transform: rotateX(25deg) translateY(-20px);
transform-origin: bottom center;
background: #9f476f;
}
#tab-top:checked~.cube {
transform: rotateX(-90deg);
}
#tab-front:checked~.cube {
transform: rotateX(0deg);
}
#tab-bottom:checked~.cube {
transform: rotateX(90deg);
}
#tab-back:checked~.cube {
transform: rotateX(45deg);
}

<h4>Standard Accordion with A little styling</h4>
<div class="perspective">
<label class="tab" for="tab-top">TOP</label>
<label class="tab" for="tab-front">FRONT</label>
<label class="tab" for="tab-bottom">BOTTOM</label>
<label class="tab" for="tab-bottom">BACK</label>
<input type="radio" name="tabs" id="tab-top">
<input type="radio" name="tabs" id="tab-front">
<input type="radio" name="tabs" id="tab-bottom">
<input type="radio" name="tabs" id="tab-back">
<div class="cube">
<div class="tab-content">
<h1>TOP CONTENT</h1>
<p>THIS IS AWESOME</p>
</div>
<div class="tab-content">
<h1>FRONT CONTENT</h1>
<p>THIS IS COOL</p>
</div>
<div class="tab-content">
<h1>BOTTOM CONTENT</h1>
<p>THIS IS SWEET</p>
</div>
<div class="tab-content">
<h1>BACK CONTENT</h1>
<p>THIS IS SPECTACULAR</p>
</div>
</div>
</div>
&#13;
答案 0 :(得分:1)
您错过了更改最后一项的课程。
现在:
<label class="tab" for="tab-bottom">BACK</label>
应该是:
<label class="tab" for="tab-back">BACK</label>
答案 1 :(得分:0)
看起来你只需要改变
<label class="tab" for="tab-bottom">BACK</label>
到
<label class="tab" for="tab-back">BACK</label>
您已复制tab-bottom
标签。
请参阅此fiddle以获取完整的工作示例。