tabs html code example

Example 1: add tabs html

&nbsp;  <!-- 1 space -->
&ensp;	<!-- tab; 2 space -->
&emsp;	<!-- tab; 4 space -->

Example 2: tabs characters in html

<pre>&#9;</pre>

Example 3: javascript tabs example

const showHideAll =(list)=>{
  for(var i = 0; i < list.length; i++){
      list[i].classList.remove('show');
      list[i].classList.add('hide'); // depending on what you're doing
  }
}

window.onload = function() {
  let innerDiv = document.getElementsByClassName("inner-description");
  let clicked = document.querySelectorAll('.show-hide-description');
  clicked.forEach((item, i) => {
    let clickedId = item.id;
    document.querySelector(`#${clickedId}`).addEventListener('click',()=>{
      let clickedIdDescription = document.getElementById(`${clickedId}-description`);
      if(clickedIdDescription.classList.contains('show')){
        showHideAll(innerDiv)
      } else {
        showHideAll(innerDiv)
        clickedIdDescription.classList.remove('hide');
        clickedIdDescription.classList.add('show');
      }
    })
  });
}

Example 4: tab view in html

<ul class="nav nav-tabs" id="myTab" role="tablist">
  <li class="nav-item">
    <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a>
  </li>
</ul>
<div class="tab-content" id="myTabContent">
  <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div>
  <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
  <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div>