Template – Creating manual tabbed content in WP

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial;}

/* Style the tab */
.tab {
  overflow: hidden;
  border: 3px solid #02ac12;
  background-color: #ffffff;
}

/* Style the buttons inside the tab */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.5s;
  font-size: 20px;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}
</style>
</head>
<body>

<p>Click on the buttons inside the tabbed menu:</p>

<div class="tab">
  <button class="tablinks" onclick="openTab(event, 'A+')">CompTIA A+</button>
  <button class="tablinks" onclick="openTab(event, 'CCNA')">Cisco CCNA</button>
</div>

<div id="A+" class="tabcontent">
  <p>I've completed my CompTIA A+ certification in high school and have recently renewed my certification which will expire in 2025, I will add the credential ID here soon. </p>
</div>

<div id="CCNA" class="tabcontent">
  <p>This certification is in progress, and I'm currently using a training program with IT PRO TV which includes both video content and practice labs. I hope to finish the actual learning content by the time I return from studying abroad this semester and plan to take the CCNA certification exam in early 2024.</p> 
</div>

<script>
function openTab(evt, cityName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(cityName).style.display = "block";
  evt.currentTarget.className += " active";
}
</script>
   
</body>
</html>


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *