Comment créer : bouton de chargement

Apprendre à utiliser CSS pour créer un bouton de chargement.

Comment définir le style du bouton de chargement

Première étape - Ajouter HTML :

Ajouter une bibliothèque d'icônes, par exemple Font Awesome, et attacher les icônes au bouton HTML :

<!-- Ajouter la bibliothèque d'icônes -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Ajouter l'icône Font Awesome au bouton (attention, la classe fa-spin fait tourner l'icône) -->
<button class="buttonload">
  <i class="fa fa-spinner fa-spin"></i>Loading
</button>
<button class="buttonload">
  <i class="fa fa-circle-o-notch fa-spin"></i>Loading
</button>
<button class="buttonload">
  <i class="fa fa-refresh fa-spin"></i>Loading
</button>

Deuxième étape - Ajouter CSS :

/* Définir le style du bouton */
.buttonload {
  background-color: #04AA6D; /* Fond vert */
  border: none; /* Supprimer la bordure */
  color: white; /* Texte en blanc */
  padding: 12px 16px; /* Certaines marges internes */
  font-size: 16px /* Définir la taille du texte */
}

Try it yourself

Page relative

教程:Tutoriel d'icône

教程:Bouton CSS

教程:Tutoriel :