'Vertical Tabs'

We are defining the steps 'how to create - vertical tabs'

how to create vertical tabs

Step1

Add this style css before the closing of </head> tag

<style type="text/css">
* {box-sizing: border-box}
.tabContainer{width: 40%; margin:0 auto}
/* Style the tab */
.tab {
    float: left;
    border: 1px solid #ccc;
    background-color: #fff;
    width:30%;
    height:270px;
	border-radius: 6px 0px 0 6px ;
	font-family: arial;
	line-height: 1.5;
	font-size: 13px;
}
/* Style the buttons inside the tab */
.tab button {
    display: block;
    background-color: inherit;
    color:#444;
    padding: 22px 16px 22px 62px;
    width: 100%;
    border: none;
    outline: none;
    text-align: left;
    cursor: pointer;
    transition: 0.3s;
	font-family: arial;
    font-size: 16px;
	font-weight: bold;
	outline: 0;
}
.tab .one, .tab .two, .tab .thr, .tab .for{background:url(r-280618-w.png) 5px 12px no-repeat; border-bottom:1px solid #f2f2f2; position: relative}
.tab .one.active, .tab .two.active, .tab .thr.active, .tab .for.active{background:#ccc url(r-280618.png) 5px 12px no-repeat;}
.tab .one.active::after, .tab .two.active::after, .tab .thr.active::after, .tab .for.active::after{
content: '';
position: absolute;
top:22px;	
right:-10px;
border-top:10px solid transparent ;
border-left:10px solid #ccc;
border-bottom:10px solid transparent;
}	
	
/* Change background color of buttons on hover */
.tab button:hover {background-color: #f2f2f2;}
/* Create an active/current "tab button" class */
.tab button.active {background-color: #ccc;}
/* Style the tab content */
.tabcontent {
    float: left;
    padding: 0px 12px 0px 24px;
    border: 1px solid #ccc;
    width: 70%;
    border-left: none;
    height: 270px;
	border-radius: 0 6px 6px 0;
	background: #f9f9f9;
	font-family: arial;	
}
.tabcontent h3{font-size: 16px; font-weight: bold;color:#11a39f}	
.tabcontent p{line-height: 1.5; font-size: 14px; text-align: justify}
</style>	

Step2

Paste the html into the <body> tag

<div class="tabContainer">
<div class="tab">
  <button class="tlink one" onclick="tabOpen(event, 'ipsum01')" id="dOpen">Lorem Ipsum 01</button>
  <button class="tlink two" onclick="tabOpen(event, 'ipsum02')">Lorem Ipsum 02</button>
  <button class="tlink thr" onclick="tabOpen(event, 'ipsum03')">Lorem Ipsum 03</button>
  <button class="tlink for" onclick="tabOpen(event, 'ipsum04')">Lorem Ipsum 04</button>	
</div>
<div id="ipsum01" class="tabcontent">
  <h3>What is Lorem Ipsum?</h3>
  <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>

<div id="ipsum02" class="tabcontent">
  <h3>Where does it come from?</h3>
  <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p> 
</div>

<div id="ipsum03" class="tabcontent">
  <h3>Why do we use it?</h3>
  <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>
<div id="ipsum04" class="tabcontent">
<h3>Where does it come from?</h3>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
</div>	
</div>

	

Step3

Simply add the below code before end of </body> tag:

<script>
function tabOpen(evt, tabName) {
var i, tabcontent, tlink;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
  tabcontent[i].style.display = "none";
}
tlink = document.getElementsByClassName("tlink");
for (i = 0; i < tlink.length; i++) {
  tlink[i].className = tlink[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("dOpen").click();
</script>
Copyright © 2020. All rights reserved.