html - Tab-model 4th child not being displayed -
i working on tab-model , got issue it. going through tab-models , found interesting. found 3 tabs. so, far know, i've added code fourth tab not being displayed. there miscalculation rotation.
.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 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 awesome</p> </div> <div class="tab-content"> <h1>front content</h1> <p>this cool</p> </div> <div class="tab-content"> <h1>bottom content</h1> <p>this sweet</p> </div> <div class="tab-content"> <h1>back content</h1> <p>this spectacular</p> </div> </div> </div>
looks need change
<label class="tab" for="tab-bottom">back</label> to
<label class="tab" for="tab-back">back</label> you have duplicated tab-bottom label.
please see fiddle working example.
Comments
Post a Comment