Гуру - Репутация: 384
- Webmoney BL:
? | Спасибо, но так не получается. Вот как я реализую табы на данный момент. Так все работает, только не выделяется активный пункт HTML
Код: <section class="tabs">
<input id="tab_1" type="radio" checked="checked" name="tab">
<input id="tab_2" type="radio" name="tab">
<input id="tab_3" type="radio" name="tab">
<div><label id="tab_l1" for="tab_1">Текст</label></div>
<div><label id="tab_l2" for="tab_2">Фото</label></div>
<div><label id="tab_l3" for="tab_3">Видео</label></div>
<div style="clear: both;"></div><div class="tabs_cont">
<div id="tab_c1">
<div id="tab_c2">
<div id="tab_c3">
</div></section><div class="ten"></div> CSS
Код: /* tabs */
.tabs {
position: relative;
margin: 0 auto;
width: 100%;}
.tabs label {
color: #555;
cursor: pointer;
display: block;
float: left;
width: 150px;
height: 45px;
line-height: 45px;
position: relative;
top: 2px;
text-align: center;
background-color: #fff;
color: #39C;
border: 1px solid #63C0DF;
font-size: 20px;
font-family: 'PT Sans Narrow', Arial, sans-serif;
margin-right: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.tabs input {
position: absolute;
left: -9999px;}
#tab_1:checked ~ #tab_l1,
#tab_2:checked ~ #tab_l2,
#tab_3:checked ~ #tab_l3 {
background: #fff;
border-color: #fff;
top: 0;
z-index: 3;
height: 0px;
}
#tab_1 {
height: 0px;
float:left;
}
#tab_2 {
height: 0px;
float:left;
}
#tab_3 {
height: 0px;
float:left;
}
.tabs_cont {
background: #fff;
position: relative;
z-index: 2;
height: 100%;
border-left: 1px solid #63C0DF;
border-right: 1px solid #63C0DF;
border-bottom: 1px solid #63C0DF;
}
.tabs_cont p {
padding: 0 15px 10px 15px;
text-indent:15px;
}
.tabs_cont h1, h3 {
padding: 0 15px 10px 15px;
font-family: 'PT Sans Narrow', Arial, sans-serif;
}
.tabs_cont img {
padding: 0px 15px 10px 15px;
text-align: center;
}
#video {
padding: 0px 15px 10px 15px;
text-align: center;
}
.tabs_cont > div {
position: absolute;
left: -9999px;
top: 0;
opacity: 0;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;}
#tab_1:checked ~ .tabs_cont #tab_c1,
#tab_2:checked ~ .tabs_cont #tab_c2,
#tab_3:checked ~ .tabs_cont #tab_c3 {
position: static;
left: 0;
opacity: 1;} |