JavaScript

Program to implement Tabs.

Program to implement Tabs.
<html>
<head>
<style>
.tab {
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: black;
}

.tab button {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
    color:white;
}

.tab button:hover {
    background-color: orange;
    color:black;
}

.tabdata {
    display: none;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-top: none;
}
</style>

<script>
function openTab(evt, language) {
    var i, tabdata, tablinks;
    tabdata = document.getElementsByClassName("tabdata");
    for (i = 0; i < tabdata.length; i++) {
        tabdata[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(language).style.display = "block";
    evt.currentTarget.className += " active";
}
</script>

</head>

<body>

<p>Click on the buttons to get inside Data:</p>

<div class="tab">
  <button class="tablinks" onclick="openTab(event, 'HTML')">HTML</button>
  <button class="tablinks" onclick="openTab(event, 'CSS')">CSS</button>
  <button class="tablinks" onclick="openTab(event, 'JavaScript')">JavaScript</button>
</div>

<div id="HTML" class="tabdata">
  <h3>HTML</h3>
  <p>HTML is used to define the content of web pages.</p>
</div>

<div id="CSS" class="tabdata">
  <h3>CSS</h3>
  <p>CSS is used to specify the layout of web pages.</p> 
</div>

<div id="JavaScript" class="tabdata">
  <h3>JavaScript</h3>
  <p>JavaScript is used to program the behavior of web pages.</p>
</div>
     
</body>
</html> 
Nitin Pandit

With over 10 years of vast development experience with different technologies, Nitin Pandit is Microsoft certified Most Valued Professional (Microsoft MVP) with a rich skillset that includes developing and managing IT/Web-based applications in different technologies, such as – C#.NET, ADO.NET, LINQ to SQL, WCF, and ASP.NET 2.0/3.x/4.0, WCF, WPF, MVC 5.0 (Razor), and Silverlight, along with client-side programming techniques, like jQuery and AngularJS. Nitin possesses a Master’s degree in Computer Science and has been actively contributing to the development community for its betterment. He has written more than 100 blogs/articles and 3 eBooks on different technologies to help improve the knowledge of young technology professionals. He has trained more than one lakh students and professionals, as a speaker in workshops and AppFests, conducted in more than 25 universities in North India.