html - Content beneath absolute positioned CSS3 Tab Bar -
i'm working on tab bar made css3 (and want avoid javascript/jquery). found nice tutorial , modified source code needs. unfortunately content beneath tab bar placed in background of "tab-content"-ids since positioned in absolute mode. want e.g. footer appear beneath tab-bar-content variable height , not behind it. tried change positioning parameters result "tab-content" flow under single tab1/2/3/4-labels.
here style sheet:
.tabs input[type=radio] { position: absolute; top: -9999px; left: -9999px; } .tabs { width: 960px; float: none; list-style: none; position: relative; padding: 0; margin-top:30px; font-size:14px; } .tabs li { float: left; } .tabs label { display: block; padding: 10px 20px; cursor: pointer; position: relative; -webkit-transition: 0.2s ease-in-out; -moz-transition: 0.2s ease-in-out; -o-transition: 0.2s ease-in-out; transition: 0.2s ease-in-out; color: #aaa; } .tabs label:hover { top: 0; color: #000; } [id^=tab]:checked + label { color: #000; } [id^=tab]:checked ~ [id^=tab-content], [id^=tab]:checked ~ [id^=tab-content] > div { display: block; } .tab-content { z-index: 2; display: none; text-align: left; overflow: hidden; width: 100%; line-height: 140%; padding-top: 10px; padding: 15px; position: absolute; top: 53px; left: 0; box-sizing: border-box; font-size:14px; float:left; } .tab-content > div { display: none; -webkit-animation-duration: 0.5s; -o-animation-duration: 0.5s; -moz-animation-duration: 0.5s; animation-duration: 0.5s; } .tabbar { float:left; width: 960px; height:auto; }
and html source code:
<!-- tabbar !--> <div class="tabbar"> <ul class="tabs"> <li> <input type="radio" checked name="tabs" id="tab1"> <label for="tab1">first tab</label> <div id="tab-content1" class="tab-content"> <div class="animated fadeinright"> lorem ipsum 1 </div> </div> </li> <li> <input type="radio" name="tabs" id="tab2"> <label for="tab2">second tab</label> <div id="tab-content2" class="tab-content"> <div class="animated fadeinright"> lorem ipsum 2 </div> </div> </li> <li> <input type="radio" name="tabs" id="tab3"> <label for="tab3">third tab</label> <div id="tab-content3" class="tab-content"> <div class="animated fadeinright "> lorem ipsum 3 </div> </div> </li> <li> <input type="radio" name="tabs" id="tab4"> <label for="tab4">fourth tab</label> <div id="tab-content4" class="tab-content"> <div class="animated fadeinright "> lorem ipsum 4 </div> </div> </li> </ul> </div>
and here example of issue on codepen: http://codepen.io/danielcoding/pen/fxrnw
i don't have idea how handle this.
thank in advance!
if understand problem, have change properites in css.
- .tab-content set whitout position propiretes(only float:left;) , set margin-top: 35px;
- .tabs label set position: absolute , set left properites ever label separetly .tabs label:nth-child(1){left:0px} .tabs label:nth-child(2){left:100px} .tabs label:nth-child(3){left:200px}
now can add div footer in end of page.
i hope help.
Comments
Post a Comment