Je souhaite afficher le contenu de chaque onglet. Mais il y a un espace vide.Espace vide entre l'onglet et le contenu
Il n'y a pas d'espace libre dans le premier onglet mais il existe dans d'autres onglets. Je veux supprimer cet écart
Comment réparer ce problème? (S'il vous plaît ne suggèrent aucun code Java Script.)
La figure suivante illustre ce problème
There is an empty space between the tab and the content
.tab-caption:nth-of-type(1) {
background-color: #FFAAAA;
}
.tab-caption:nth-of-type(2) {
background-color: #AAFFAA;
}
.tab-caption:nth-of-type(3) {
background-color: #AAAAFF;
}
.tab-content:nth-of-type(1) {
background-color: #FFAAAA;
}
.tab-content:nth-of-type(2) {
background-color: #AAFFAA;
}
.tab-content:nth-of-type(3) {
background-color: #AAAAFF;
}
.tab-status {
display: none;
}
.tab-status ~ .tab-caption-container {
display: flex;
}
.tab-status ~ .tab-caption-container > .tab-caption {
opacity: 0.4;
cursor: pointer;
}
.tab-status:nth-of-type(1):checked ~ .tab-caption-container > .tab-caption:nth-of-type(1) {
opacity: 1;
}
.tab-status:nth-of-type(2):checked ~ .tab-caption-container > .tab-caption:nth-of-type(2) {
opacity: 1;
}
.tab-status:nth-of-type(3):checked ~ .tab-caption-container > .tab-caption:nth-of-type(3) {
opacity: 1;
}
.tab-status ~ .tab-content-container > .tab-content {
width: 100%;
transform: translate(-100%);
transition: all 1s;
}
.tab-status:nth-of-type(1):checked ~ .tab-content-container > .tab-content:nth-of-type(1),
.tab-status:nth-of-type(2):checked ~ .tab-content-container > .tab-content:nth-of-type(2),
.tab-status:nth-of-type(3):checked ~ .tab-content-container > .tab-content:nth-of-type(3) {
transition: all 1s;
transform: translate(0%);
transition-delay: 1s;
}
.tab-content-container {
overflow: hidden;
width: 100%;
height: auto;
border: 1px solid #ccc;
float: left;
}
<input class="tab-status" id="tabSwitch01" type="radio" name="tab" checked="checked">
<input class="tab-status" id="tabSwitch02" type="radio" name="tab">
<input class="tab-status" id="tabSwitch03" type="radio" name="tab">
<div class="tab-caption-container">
<label class="tab-caption" for="tabSwitch01">tab1</label>
<label class="tab-caption" for="tabSwitch02">tab2</label>
<label class="tab-caption" for="tabSwitch03">tab3</label>
</div>
<div class="tab-content-container">
<div class="tab-content">tab1-data<br></div>
<div class="tab-content">tab2-data<br>tab2-data<br></div>
<div class="tab-content">tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br>tab3-data<br></div>
</div>
vous êtes le meilleur! TNQ ♥ –