It's a newbie question, but I'm having this difficulty.
I have 3 tabs that look like this:
ButI'dlikeyoutostayinthecenterlikethis:
Alsoinsteadoftext,Iwouldliketoputimages.
MyCSSforthetabslookslikethis:
/*Stylethetab*/div.tab{overflow:hidden;border:none;margin-top:-4px;background-color:#36D100;position:sticky;height:102px;width:100%;}/*Stylethebuttonsinsidethetab*/div.tabbutton{background-color:inherit;margin-top:7px;border:none;margin-bottom:center;cursor:pointer;transition:0.3s;font-size:17px;height:95px;width:186px;}/*Changebackgroundcolorofbuttonsonhover*/div.tabbutton:hover{background-color:#ddd;}/*Createanactive/currenttablinkclass*/div.tabbutton.active{background-color:#fff;}/*Stylethetabcontent*/.tabcontent{display:none;padding:6px12px;border:0pxsolid#ddd;border-top:none;}
AndmyHTML,thisway:
<content><divclass="tab">
<button class="tablinks" onclick="openCity(event, 'London')" active>London</button>
<button class="tablinks" onclick="openCity(event, 'Paris')">Paris</button>
<button class="tablinks" onclick="openCity(event, 'Tokyo')">Tokyo</button>
</div>
<div id="London" class="tabcontent" data-ng-click="London">
<h3>London</h3>
<p>London is the capital city of England.</p>
</div>
<div id="Paris" class="tabcontent">
<h3>Paris</h3>
<p>Paris is the capital of France.</p>
</div>
<div id="Tokyo" class="tabcontent">
<h3>Tokyo</h3>
<p>Tokyo is the capital of Japan.</p>
</div>
<script>
function openCity(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>
</content>
How can I do this?