Ads 468x60px

Friday, March 21, 2014

How to Creating Content Tabs with Pure CSS

Creating Content Tabs with Pure CSS it's very simple Try to this code
HTML Code here
<ul class="tabs">
<li> <input type="radio" checked name="tabs" id="tab1">
<label for="tab1"> tab 1</label>
<div id="tab-content1" class="tab-content"> Tab Content 1 </div> </li>

<li> <input type="radio" name="tabs" id="tab2"> <label for="tab2">
tab 2</label>
<div id="tab-content2" class="tab-content">
Tab Content 2 </div> </li>

<input type="radio" name="tabs" id="tab3">
<label for="tab3"> tab 3</label>
<div id="tab-content3" class="tab-content">
Tab Content 3 </div> </li>
Css Code here

body, html {
height: 100%;
margin: 0;
-webkit-font-smoothing: antialiased;
font-weight: 100;
background:#90f286 ;
text-align: center;
font-family: arial;

.tabs input[type=radio] {

.tabs {
width: 600px;
list-style: none;
position: relative;
padding: 0;
margin: 75px auto;

.tabs li{
float: left;

.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #000;
font-size: 24px;
font-weight: normal;
background: rgba(0,0,0,0.2);
cursor: pointer;
position: relative;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;

.tabs label:hover {
background: #0a71a5;
top: 0;

[id^=tab]:checked + label {
background: #0a71a5;
color: white;
top: 0;

[id^=tab]:checked ~ [id^=tab-content] {
display: block;

z-index: 2;
display: none;
text-align: left;
font-size: 20px;
padding-top: 10px;
background: #0a71a5;
padding: 15px;
color: white;
position: absolute;
top: 51px;
left: 0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
animation-duration: 0.5s;

Demo Jsfiddle


Post a Comment