Skip to content Skip to sidebar Skip to footer

Convert Horizontal Tabs To Vertical (HTML & CSS Only, No Js)

I'm trying to create a basic portal with tabs on the left, rather than on top. Ideally, I would like to accomplish this without any javascript; with HTML5 & CSS3 only. I've bee

Solution 1:

Working DEMO

Tweaked some CSS for content & label

* {
  margin: 0;
  padding: 0;
}
body {
    background: #999;  
}
#page-wrap {
  width: 1024px; 
  height: 768px;
}
    .tabs {
      position: relative;   
      min-height: 200px; /* This part sucks */
      clear: both;
      margin: 25px 0;      
    }
    .tab {
      /*float: left; */     
       height: 41px; 
    }
    .tab label {
      background: #eee; 
      padding: 10px; 
      border: 1px solid #ccc; 
      margin-left: -1px; 
      position: relative;
      left: 1px;        
      width: 70px;
      display: block;
    }
    .tab [type=radio] {
      display: none;   
    }
    .content {
      position: absolute;
      top: 0px;
      left: 92px;
      background: white;
      right: 0;
      bottom: 0;
      padding: 20px;
      border: 1px solid #ccc;       
    }
    [type=radio]:checked ~ label {
      background: white;
      border-bottom: 1px solid white;
      z-index: 2;
    }
    [type=radio]:checked ~ label ~ .content {
      z-index: 1;
    }

Post a Comment for "Convert Horizontal Tabs To Vertical (HTML & CSS Only, No Js)"