By
terminotor
Есть код с вкладками:
<section class="tabs">
<input id="tab-1" type="radio" name="radio-set" class="tab-selector-1" checked="checked" />
<label for="tab-1" class="tab-label-1">Tab 1</label>
<input id="tab-2" type="radio" name="radio-set" class="tab-selector-2" />
<label for="tab-2" class="tab-label-2">Tab 2</label>
<input id="tab-3" type="radio" name="radio-set" class="tab-selector-3" />
<label for="tab-3" class="tab-label-3">Tab 3</label>
<input id="tab-4" type="radio" name="radio-set" class="tab-selector-4" />
<label for="tab-4" class="tab-label-4">Tab 4</label>
<div class="content54">
<div class="content-1">
<h2>Tab 1</h2>
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div class="content-2">
<h2>Tab 2</h2>
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div class="content-3">
<h2>Tab 3</h2>
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
<div class="content-4">
<h2>Tab 4</h2>
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commod. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
</section>
body {
background: #232222;
font-family: 'Raleway', Arial, Helvetica, sans-serif;
text-align: center;
color: #fefefe;
overflow-y: scroll;
}
a {
text-decoration: none;
}
a.link {
color: #FF6347;
-webkit-transition: all 150ms ease 0s;
transition: all 150ms ease 0s;
}
a.link:hover {
color: #000;
}
p {
margin-bottom: 10px;
}
.tabs {
position: relative !important;
margin: 40px auto !important;
width: 1024px !important;
max-width: 100% !important;
overflow: hidden !important;
padding-top: 10px !important;
margin-bottom: 60px !important;
}
.tabs input {
position: absolute !important;
z-index: 1000 !important;
width: 25% !important;
height: 50px !important;
left: 0 !important;
top: 0 !important;
opacity: 0 !important;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)" !important;
filter: alpha(opacity=0) !important;
cursor: pointer !important;
margin: 0 !important;
}
.tabs input#tab-2 {
left: 25% !important;
}
.tabs input#tab-3 {
left: 50% !important;
}
.tabs input#tab-4 {
left: 75% !important;
}
.tabs label {
background: #FF6347;
color: #fefefe;
font-size: 15px !important;
line-height: 50px !important;
height: 60px !important;
position: relative !important;
top: 0 !important;
padding: 0 20px !important;
float: left !important;
display: block !important;
width: 25% !important;
letter-spacing: 1px !important;
font-weight: bold !important;
text-align: center !important;
box-shadow: 2px 0 2px rgba(0, 0, 0, 0.1), -2px 0 2px rgba(0, 0, 0, 0.1) !important;
box-sizing: border-box !important;
-webkit-transition: all 150ms ease 0s !important;
transition: all 150ms ease 0s !important;
}
.tabs label:hover {
cursor: pointer !important;
}
.tabs label:after {
content: '' !important;
background: #fefefe !important;
position: absolute !important;
bottom: -2px !important;
left: 0 !important;
width: 100% !important;
height: 2px !important;
display: block !important;
}
.tabs input:hover + label {
background: #FF6347 !important;
/*e08f24*/
}
.tabs label:first-of-type {
z-index: 4 !important;
}
.tab-label-2 {
z-index: 4 !important;
}
.tab-label-3 {
z-index: 3 !important;
}
.tab-label-4 {
z-index: 2 !important;
}
.tabs input:checked + label {
background: #fefefe !important;
color: #1a1a1a !important;
z-index: 6 !important;
}
.content54 {
height: auto !important;
width: 100% !important;
float: left !important;
position: relative !important;
z-index: 5 !important;
background: #fefefe !important;
top: -10px !important;
box-sizing: border-box !important;
}
.content54 div {
position: relative !important;
float: left !important;
width: 0 !important;
height: 0 !important;
box-sizing: border-box !important;
top: 0 !important;
left: 0 !important;
z-index: 1 !important;
opacity: 0 !important;
background: #fefefe !important;
}
.content54 div h2 {
margin-top: 0 !important;
}
.tabs .tab-selector-1:checked ~ .content54 .content-1,
.tabs .tab-selector-2:checked ~ .content54 .content-2,
.tabs .tab-selector-3:checked ~ .content54 .content-3,
.tabs .tab-selector-4:checked ~ .content54 .content-4 {
z-index: 100 !important;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)" !important;
filter: alpha(opacity=100) !important;
opacity: 1 !important;
width: 100% !important;
height: auto !important;
width: 100% !important;
height: auto !important;
padding: 8% !important;
}
.content54 div h2 {
color: #4477CC !important;
}
.content54 div p {
font-size: 14px !important;
line-height: 22px !important;
text-align: left !important;
margin: 0 !important;
color: #777 !important;
}
и всё бы хорошо, но в Opera при переключении табов постоянно перебрасывает в начало страницы. Может кто сталкивался - как решить?
Question
Driven
Всем привет! Не получается сверстать вот такие табы
не могу понять что делаю не так . все что получается у меня это
непонятно почему вылезла эта линия внизу, в не активном режиме и не получается ее скрыть. При нажатии вроде как все нормально , а вот именно сначала вылазит эта линия . Надеюсь на помощь )
вот код
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.