dasar tab 2 - VIEW-SOURCE:
44444444

dasar tab 2

222222222


Ringkasan

Metode ini memberi Anda ukuran dinamis untuk tab dan area konten. Anda dapat membuat tab tinggi yang bervariasi seperti yang Anda lihat dan itu hanya berfungsi. Tab dapat berupa lebar variabel. Konten dapat berupa tinggi variabel (tetapi tidak lebar variabel, meskipun itu tidak masuk akal). Dengan javascript yang sangat sedikit dan beberapa CSS lainnya kami mendapatkan dukungan untuk IE6+.

The HTML Structure



<div class="tabs">
  
  <div class="tab">
    <input class="tab-radio" type="radio" id="tab-1" name="tab-group-1" checked>
    <label class="tab-label" for="tab-1">TAB 1</label>
    
    <div class="tab-panel">
      <div class="tab-content">
        <h3>Why would this be cool?</h3>
        <p>First look at the HTML structure: all elements related to one tab are within one block. Now think about that for a while. This must be done by Chris Coyier's <a href="https://css-tricks.com/functional-css-tabs-revisited/">Functional CSS Tabs Revisited</a> already, right?</p>
        <p>Maybe. But then you may notice another thing: Chris' example uses absolute positioning for the content. This means the tabs must be of fixed height. Yet these tabs here certainly aren't!</p>
      </div>
    </div> 
  </div>
  
  <div class="tab">
    <input class="tab-radio" type="radio" id="tab-2" name="tab-group-1">
    <label class="tab-label" for="tab-2">Variable height content</label>
    
    <div class="tab-panel">
      <div class="tab-content">
        <h3>What is this devilry?</h3>
        <p>First of all we are working with inline content here and being smart about it. We eliminate white space using the dirty but sufficient zero font-size.</p>
        <p>There is one additional element in comparison to what Chris had:  .tab-panel  element, which works as a container for the  .tab-content  element. The panel is inline-block by default, which means it can take styles like overflow, position, and width and height. We set these to zero size, use  overflow: hidden;  and  >position: relative;  so that .tab-content  disappears. For the active tab we do only one style change and it happens to the  .tab-panel  element: we make it inline! Thus it no longer follows the other rules that bind inline-block. As a result it's child element will start following the flow of the next container element up in the tree.</p>
        <p>As for the  .tab-content  element it is floated and has a width of 100%. The neat thing about this combination is that it forces the element to go below the row where you can see the tab buttons.</p>
      </div>
    </div>
  </div>
  
  <div class="tab">
    <input class="tab-radio" type="radio" id="tab-3" name="tab-group-1">
    <label class="tab-label" for="tab-3">Browser support</label>
    <div class="tab-panel">
      <div class="tab-content">
        <h3>The support must be poor!</h3>
        <p>The CSS only part of this solution works in Internet Explorer 9+. All the other browsers are supported from so far back that it is enough to tell this works on Firefox, Chrome, Safari and Opera.</p>
        <p>The JavaScript is quite simple and it is for IE8 and below. It does no harm to other browsers, but you probably want to hide it behind IE conditional comments:  &lt;!--[if lte IE 8]&gt; &hellip; &lt;![endif]--&gt; </p>
      </div>
    </div>
  </div>



<style>
.tabs {
  font-size: 0;
  margin: 25px 0;
}

.tabs:after {
  clear: both;
  content: '';
  display: table;
}

.tabs .tab {
  display: inline;
}

.tabs .tab-label {
  background: #FF0000; /* TOMBOL TAB DIAM*/
  border: 1px solid #ccc; 
  display: inline-block;
  font-size: 16px;
  font-size: 1rem;
  left: 1px;
  margin-left: -1px;
  padding: 10px; 
  position: relative;
  vertical-align: bottom;
}

.tabs .tab > [type="radio"] {
  clip: rect(0 0 0 0);
  height: 1px;
  opacity: 0;
  position: fixed;
  width: 1px;
  z-index: -1;
}

.tabs .tab-panel {
  display: inline;
  display: inline-block;
  overflow: hidden;
  position: relative;
  height: 0;
  width: 0;
}

.tabs .tab-content {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  display: block;
  background:  #e67e22;/*BG KOTAK TAB ATAS*/
  padding: 0 20px;
  border: 1px solid #ccc;
  float: left;
  font-size: 16px;
  font-size: 1rem;
  margin-top: -1px;
  width: 100%;
}

.tabs .tab [type="radio"]:checked + .tab-label {
  background: #7c7268;/*TOMBOL TAB AKTIF*/
  border-bottom-width: 0;
  padding-bottom: 11px;
  z-index: 1;
}

.tabs .tab [type="radio"]:checked ~ .tab-panel {
  display: inline;
}


/*

=======================================
INTERNET EXPLORER 8 and below 
=======================================

*/
@media \0screen\,screen\9 {
  /* IE7 and IE6 */
  .tabs {
    zoom: 1;
  }
  
  /* IE8 and below */
  .tabs .tab .tab-radio {
    filter: Alpha(opacity=0);
    position: absolute;
    z-index: -1;
  }
  
  /* IE7 and IE6 */
  .tabs .tab .tab-panel, {
    display: none;
    height: auto;
    overflow: visible;
    position: static;
    width: auto;
  }
  
  /* IE7 and IE6 */
  .tabs .tab-content, {
    float: none;
    padding-bottom: 1px;
    padding-top: 1px;
    width: auto;
  }
  
  /* IE8 and below */
  .tabs .checked label {
    background: white;
    border-bottom-width: 0;
    padding-bottom: 11px;
    z-index: 1;
  }
  
  /* IE8 */
  .tabs .checked .tab-panel {
    display: inline;
  }
  /* IE7 and IE6 */
  .tabs .checked .tab-panel, {
    display: inline;
    float: left;
    width: 100%;
  }
}






/*

=======================================
UNIMPORTANT STYLES BEGIN HERE
=======================================

*/
html {
  background: #59797a;
  color: #DDD;
  padding: 1em;
}

a:link,a:visited,a:hover,a:focus,a:active {
  color: #58C;
}

label {
  cursor: pointer;
}

.tabs {
  color: #222;
}

.tabs a:link,.tabs a:visited,.tabs a:hover,.tabs a:focus,.tabs a:active {
  color: #36A;
}

body > h3 {
  font-variant: small-caps;
  letter-spacing: .0625em;
}

p {
  line-height: 1.5;
  max-width: 50em;
}

code,pre {
  font-family: 'Lucida Console', monospace;
}

pre {
  background: #191919;
  color: #8DA;
  overflow-x: auto;
  padding: 1em;
}

p > code {
  background: #DED;
  margin: -2px;
  padding: 2px;
}

.for {
  display: inline-block;
  position: relative;  
}

.for:after {
  background: #DDD;
  bottom: 150%;
  color: #222;
  font-family: sans-serif;
  font-size: 12px;
  opacity: 0;
  padding: .5em;
  pointer-events: none;
  position: absolute;
  right: 0;
  -webkit-transition: opacity .2s ease-in-out;
  transition: opacity .2s ease-in-out;
  white-space: nowrap;
}

.for:hover:after {
  opacity: 1;
}

.for.default-tab {
  color: #8AD;
}

.for.ie8-and-below {
  color: #DA8;
}

.for.default-tab:after {
  content: 'For default tab';  
}

.for.ie8-and-below:after {
  content: 'For IE8 and below';  
}

/* and just for fun... */
@media only screen and (max-width: 43em) {
  .tabs .tab > label {
    background: #BBB;
    border-color: #999;
    
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    width: 100%;
  }
  .tabs .tab [type="radio"]:checked + .tab-label {
    background: #222;
    border-color: #444;
    color: #DDD;
  }
}
</style>
 







<script> 
if(window.ltIE9) {
  (function($) {
    $('.tabs input[type="radio"]:checked')
    .closest('.tab')
    .addClass('checked');
    $('html').on('click', '.tabs input', function() {
      $('input[name="' + this.name + '"]')
      .closest('.tab')
      .removeClass('checked');
      $(this)
      .closest('.tab')
      .addClass('checked');
    });
  })(window.jQuery);
}

</script>
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'/>




.

BERAPA NILAI ARTIKEL INI

Loading Content...