oftenwrongthemes

HTML/CSS Tabs Base Code

Nov 6th, 2015
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. /*THIS IS THE CSS*/
  2.  
  3. .tabs {
  4. position: relative;
  5. width: /*here*/;
  6. height: /*here*/;
  7. }
  8.  
  9. .tab {
  10. float: left;
  11. }
  12.  
  13. .tab label {
  14. background: #eee;
  15. padding: 10px;
  16. border: 1px solid #ccc;
  17. margin-left: -1px;
  18. position: relative;
  19. left: 1px;
  20. top: 0px;
  21. }
  22.  
  23. .tab [type=radio] {
  24. display: none;
  25. }
  26.  
  27. .content {
  28. position: absolute;
  29. top: 28px;
  30. bottom: 0px;
  31. left: 0px;
  32. right: 0px;
  33. background: white;
  34. padding: 20px;
  35. border: 1px solid #ccc;
  36. }
  37. .tab [type=radio]:checked ~ label {
  38. background: white;
  39. border-bottom: 1px solid white;
  40. z-index: 2;
  41. }
  42.  
  43. .tab [type=radio]:checked ~ label ~ .content {
  44. z-index: 1;
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. <!---THIS IS THE HTML--->
  53.  
  54. <center><div class="tabs">
  55.  
  56. <div class="tab">
  57. <input type="radio" id="tab-1" name="tab-group-1" checked>
  58. <label for="tab-1">Tab One</label>
  59. <div class="content">
  60. tab one stuff
  61. </div>
  62. </div>
  63.  
  64. <div class="tab">
  65. <input type="radio" id="tab-2" name="tab-group-1">
  66. <label for="tab-2">Tab Two</label>
  67. <div class="content">
  68. tab two stuff
  69. </div>
  70. </div>
  71.  
  72. <div class="tab">
  73. <input type="radio" id="tab-3" name="tab-group-1">
  74. <label for="tab-3">Tab Three</label>
  75. <div class="content">
  76. tab three stuff
  77. </div>
  78. </div>
  79.  
  80. </div></center>
Advertisement
Add Comment
Please, Sign In to add comment