From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/css/background/index.html | 160 +++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 files/fr/web/css/background/index.html (limited to 'files/fr/web/css/background/index.html') diff --git a/files/fr/web/css/background/index.html b/files/fr/web/css/background/index.html new file mode 100644 index 0000000000..ea37897c46 --- /dev/null +++ b/files/fr/web/css/background/index.html @@ -0,0 +1,160 @@ +--- +title: background +slug: Web/CSS/background +tags: + - CSS + - Propriété + - Reference +translation_of: Web/CSS/background +--- +
{{CSSRef}}
+ +

La propriété CSS background est une propriété raccourcie qui permet de définir les différentes valeurs des propriétés liées à la gestion des arrière-plans d'un élément (couleur, image, origine, taille, répétition, etc.).

+ +
{{EmbedInteractiveExample("pages/css/background.html")}}
+ + + +

Elle permet de définir une ou plusieurs valeurs pour : {{cssxref("background-clip")}}, {{cssxref("background-color")}}, {{cssxref("background-image")}}, {{cssxref("background-origin")}}, {{cssxref("background-position")}}, {{cssxref("background-repeat")}}, {{cssxref("background-size")}}, et {{cssxref("background-attachment")}}.

+ +

Lorsqu'on utilise la propriété raccourcie background, les valeurs fournies sont appliquées et pour les valeurs absentes, la propriété réinitialisera les propriétés détaillées avec leurs valeurs initiales.

+ +
+

Note : La propriété {{cssxref("background-color")}} ne peut être définie que sur le dernier arrière-plan car il n'y a qu'une seule couleur d'arrière-plan pour un élément.

+
+ +

Syntaxe

+ +
/* On utilise une couleur <background-color> */
+background: green;
+
+/* Ici, une <bg-image> avec <repeat-style> */
+background: url("test.jpg") repeat-y;
+
+/* Là <box> et <background-color> */
+background: border-box red;
+
+/* Ici on utilise une seule image, centrée */
+/* et remise à l'échelle */
+background: no-repeat center/80% url("../img/image.png");
+
+ +

La propriété background permet de définir une ou plusieurs couches d'arrière-plan, séparées par des virgules. Chacune des couches peut être définie avec :

+ + + +

Valeurs

+ +
+
<attachment>
+
Voir {{cssxref("background-attachment")}}
+
<box>
+
Voir {{cssxref("background-clip")}} et {{cssxref("background-origin")}}
+
<background-color>
+
Voir {{cssxref("background-color")}}
+
<bg-image>
+
Voir {{Cssxref("background-image")}}
+
<position>
+
Voir {{cssxref("background-position")}}
+
<repeat-style>
+
Voir {{cssxref("background-repeat")}}
+
<bg-size>
+
Voir {{cssxref("background-size")}}.
+
+ +

Syntaxe formelle

+ +
{{csssyntax}}
+ +

Exemples

+ +

HTML

+ +
<p class="banniere">
+  Dessine-moi une étoile<br/>
+  Qui brille<br/>
+  Dans le ciel.
+</p>
+<p class="attention">Voici un paragraphe !<p>
+ +

CSS

+ +
.attention {
+  background: pink;
+}
+
+.banniere {
+  background: url("https://mdn.mozillademos.org/files/11983/starsolid.gif") #99f repeat-y fixed;
+}
+
+ +

Résultat

+ +

{{EmbedLiveSample("Exemples")}}

+ +

Accessibilité

+ +

Les navigateurs ne fournissent pas d'informations spécifiques aux outils d'assistance quant aux images d'arrière-plan. Les lecteurs d'écran ne pourront donc pas annoncer le sens de l'image aux utilisateurs. Si l'image contient des informations critiques pour la compréhension générale de la page, mieux vaudra décrire ces informations de façon sémantique dans le document.

+ + + +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('CSS3 Backgrounds', '#the-background', 'background')}}{{Spec2('CSS3 Backgrounds')}}La propriété raccourcie a été étendue pour gérer plusieurs arrière-plans et également gérer les propriétés {{cssxref("background-size")}}, {{cssxref("background-origin")}} et {{cssxref("background-clip")}}.
{{SpecName('CSS2.1', 'colors.html#propdef-background', 'background')}}{{Spec2('CSS2.1')}}Pas de modification significative.
{{SpecName('CSS1', '#background', 'background')}}{{Spec2('CSS1')}}Définition initiale.
+ +

{{cssinfo}}

+ +

Compatibilité des navigateurs

+ + + +

{{Compat("css.properties.background")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf