The reason behind this is that Bootstrap 3 tabs are specifically styled for anchor tags (<a>
). Without the anchor tags, the necessary styling for tab navigation is not applied. Below is a snippet of the Bootstrap 3 CSS code for Tabs:
.nav-tabs > li > a {
margin-right: 2px;
line-height: 1.428571429;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover {
border-color: #eeeeee #eeeeee #dddddd;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: #555555;
cursor: default;
background-color: #ffffff;
border: 1px solid #dddddd;
border-bottom-color: transparent;
}
For a demonstration, you can check out this Demo:
<ul class="nav nav-tabs">
<li class="active"><a href="#">Chart 1</a></li>
<li><a href="#">Chart 2</a></li>
<li><a href="#">Chart 3</a></li>
<li><a href="#">Chart 4</a></li>
</ul>