Je souhaite créer un texte au centre de la classe "toggle-label" verticalement avec "switch" mais j'ai échoué C'est le code que j'utilise
.toggle-label {
font-weight: bold;
font-size: 20px;
}
.switch {
position: relative;
display: inline-block;
width: 54px;
height: 28px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider-round {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 34px;
}
.slider-round:before {
position: absolute;
content: "";
height: 20px;
width: 20px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50%;
}
.switch input:checked+.slider-round {
background-color: #e53f71;
}
.switch input:focus+.slider-round {
box-shadow: 0 0 1px #e53f71;
}
.switch input:checked+.slider-round:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
<span class="toggle-label">BGM</span>
<label class="switch" style="margin-right: 20px;">
<input type="checkbox" id="bgm" checked>
<span class="slider-round"></span>
</label>
<span class="toggle-label">SFX</span>
<label class="switch">
<input type="checkbox" id="sfx" checked>
<span class="slider-round"></span>
</label>
J'ai essayé de définir le remplissage supérieur de l'onglet bascule mais cela ne fonctionne toujours pas S'il vous plaît, aidez-moi à centrer l'étiquette à bascule verticalement avec l'interrupteur
1 réponse
Essayez d'ajouter
Alignement vertical : milieu ; à
.toggle-labelet .switch. Cela devrait les mettre à l’aise les uns avec les autres.
Outils chauds Tags
Hot Questions
Hot Tools
Collection de bibliothèques d'exécution vc9-vc14 (32 + 64 bits) (lien ci-dessous)
Téléchargez la collection de bibliothèques d'exécution requises pour l'installation de phpStudy
VC9 32 bits
Bibliothèque d'exécution de l'environnement d'installation intégré VC9 32 bits phpstudy
Version complète de la boîte à outils du programmeur PHP
Programmer Toolbox v1.0 Environnement intégré PHP
VC11 32 bits
Bibliothèque d'exécution de l'environnement d'installation intégré VC11 phpstudy 32 bits
SublimeText3 version chinoise
Version chinoise, très simple à utiliser
Sujets chauds





