一款纯css3实现的tab选项卡_html/css_WEB-ITnose
程序员文章站
2022-04-27 08:04:26
...
今天给大家带来一款纯css3实现的tab选项卡。单击左侧的选项的时候,右侧内容以动画的形式展示。效果图如下:
在线预览 源码下载
实现的代码。
html代码:
css3代码:
/*------------------------------------*\ #RESET\*------------------------------------*/.night-tabs a,.night-tabs div,.night-tabs em,.night-tabs img,.night-tabs ul,.night-tabs label,.night-tabs li,.night-tabs ol,.night-tabs p,.night-tabs span,.night-tabs ul { /* ->>> Structure >> Structure >> Structure >> Typography >> CSS3 >> Prevents double-click selection. li { /* Structure */ left: 0; opacity: 0; overflow: auto; padding: 1em 1.5em; /* ->>> Spacing for content. >> Intensity of tab effects. .content1:checked~ul>.content1,.night-tabs>.content2:checked~ul>.content2,.night-tabs>.content3:checked~ul>.content3,.night-tabs>.content4:checked~ul>.content4 { /* Structure */ opacity: 1; visibility: visible; /* CSS3 */ -webkit-transform: none; -ms-transform: none; transform: none}/*------------------------------------*\ #SLIDE EFFECTS\*------------------------------------*//* ->>> Slide Up li { -webkit-transform: translateY(30px); -ms-transform: translateY(30px); transform: translateY(30px)}/* ->>> Slide Down li { -webkit-transform: translateY(-30px); -ms-transform: translateY(-30px); transform: translateY(-30px)}/* ->>> Slide Left li { -webkit-transform: translateX(-30px); -ms-transform: translateX(-30px); transform: translateX(-30px)}/* ->>> Slide Right li { -webkit-transform: translateX(30px); -ms-transform: translateX(30px); transform: translateX(30px)}/* ->>> Slide Up + Left li { -webkit-transform: translate(-30px, -30px); -ms-transform: translate(-30px, -30px); transform: translate(-30px, -30px)}/* ->>> Slide Up + Right li { -webkit-transform: translate(30px, -30px); -ms-transform: translate(30px, -30px); transform: translate(30px, -30px)}/* ->>> Slide Down + Left li { -webkit-transform: translate(-30px, 30px); -ms-transform: translate(-30px, 30px); transform: translate(-30px, 30px)}/* ->>> Slide Down + Right li { -webkit-transform: translate(30px, 30px); -ms-transform: translate(30px, 30px); transform: translate(30px, 30px)}/*------------------------------------*\ #SLIDE EFFECTS\*------------------------------------*//* ->>> Rotate ul > li { -o-transform: rotate(10deg); -ms-transform: rotate(10deg); -moz-transform: rotate(10deg); -webkit-transform: rotate(10deg)}.night-tabs-animation-rotate.night-tabs.night-tabs-position-vleft > ul > li,.night-tabs-animation-rotate.night-tabs.night-tabs-position-vright > ul > li { -o-transform: rotate(-10deg); -ms-transform: rotate(-10deg); -moz-transform: rotate(-10deg); -webkit-transform: rotate(-10deg)}/* ->>> Scale ul > li { -webkit-transform: scale(0.6, 0.6); -ms-transform: scale(0.6, 0.6); transform: scale(0.6, 0.6)}/* ->>> Flip li { -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg)}.night-tabs-animation-flip.night-tabs-position-vleft > .night-tabs-content > li { -webkit-transform: rotateY(90deg); transform: rotateY(90deg)}.night-tabs-animation-flip.night-tabs-position-vright > .night-tabs-content > li { -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg)}/** * CONTENTS - layouts.css * * HORIZONTAL POSITIONS * Basic horizontal positions: top, left, right, and justify. * * VERTICAL POSITIONS * Basic vertical positions, vertical left and vertical right. * *//*------------------------------------*\ #HORIZONTAL POSITIONS\*------------------------------------*//* ->>> Left, Center, Right >> Justified input:first-child + label {padding-left: 0}.night-tabs-position-justify2 > label {width: 50%}.night-tabs-position-justify3 > label {width: 33.33%}.night-tabs-position-justify4 > label {width: 25%}/*------------------------------------*\ #VERTICAL POSITIONS\*------------------------------------*//* ->>> General Styles li,.night-tabs-position-vright .night-tabs-content > li {border-top: 0}.night-tabs-position-vleft > label,.night-tabs-position-vright > label { clear: left; display: block; float: left; margin-right: 0; width: 25%}/* ->>> Vertical Left .night-tabs-content {margin-left: 25%}/* ->>> Vertical Right label { clear: right; float: right}.night-tabs-position-vright ul li { border-right: 1px solid #333}.night-tabs-position-vright > .night-tabs-content {margin-right: 25%}.night-tabs-position-vright .night-tabs-content > li { -webkit-transform-origin: 100% 0%; -ms-transform-origin: 100% 0%; transform-origin: 100% 0%}/** * CONTENTS - typography.css * * BASIC TYPOGRAPHY * Styles for headings,paragraphs, and links. * * EXTENDED TYPOGRAPHY * Styling for images, unordered and ordered lists, and utility classes. * * GRID SYSTEM * Basic 12 fluid column grid system with offset support. * *//*------------------------------------*\ #BASIC TYPOGRAPHY\*------------------------------------*//* ->>> Headings >> Paragraphs >> Links >> FontAwesome >> Images >> Lists >> Utility >> Micro-Clearfix >> Basic Structure >> Grid System Config >> Default (Gray/Grey) >> Blue >> Red >> Green >> Purple >> Orange >> Yellow >> Pink >> Brown >> Teal >> Turquoise label { display: block; float: none; width: 100%; padding-right: 0; padding-left: 0; text-align: left; margin: 0 } .night-tabs > .night-tabs-content { margin-top: 0; margin-right: 0; margin-left: 0 } .night-tabs > .night-tabs-content > li { -webkit-transform-origin: 50% 0%; -ms-transform-origin: 50% 0%; transform-origin: 50% 0% } .night-tabs.night-tabs-animation-flip > ul > li { -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg) }} body { background: #111; margin-top: 2em }