Propriété CSS scroll-behavior
Exemple
Ajoutez un effet de défilement fluide au document :
html {
scroll-behavior: smooth;
}
Définition et utilisation
La scroll-behavior
propriété spécifie s'il faut animer en douceur la position de défilement, au lieu d'un saut direct, lorsque l'utilisateur clique sur un lien dans une boîte déroulante.
Valeur par défaut: | auto |
---|---|
Hérité: | non |
Animable : | non. En savoir plus sur l'animation |
Version: | Module d'affichage CSSOM (ébauche de travail) |
Syntaxe JavaScript : | objet .style.scrollBehavior="lisse" |
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
Property | |||||
---|---|---|---|---|---|
scroll-behavior | 61.0 | 79.0 | 36.0 | 14.0 | 48.0 |
Syntaxe CSS
scroll-behavior: auto|smooth|initial|inherit;
Valeurs de propriété
Value | Description |
---|---|
auto | Allows a straight jump "scroll effect" between elements within the scrolling box. This is default |
smooth | Allows a smooth animated "scroll effect" between elements within the scrolling box. |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |