From 258ba7b4be62d8640477a3bd3146d08b00cb70ec Mon Sep 17 00:00:00 2001 From: julieng Date: Fri, 17 Sep 2021 20:59:20 +0200 Subject: convert content to md --- files/fr/web/css/id_selectors/index.md | 103 +++++++++++++-------------------- 1 file changed, 40 insertions(+), 63 deletions(-) (limited to 'files/fr/web/css/id_selectors') diff --git a/files/fr/web/css/id_selectors/index.md b/files/fr/web/css/id_selectors/index.md index ee74a72867..63096c058a 100644 --- a/files/fr/web/css/id_selectors/index.md +++ b/files/fr/web/css/id_selectors/index.md @@ -9,78 +9,55 @@ tags: translation_of: Web/CSS/ID_selectors original_slug: Web/CSS/Sélecteurs_d_ID --- -
{{CSSRef("Selectors")}}
+{{CSSRef("Selectors")}} -

Un sélecteur d'identifiant (ID selector) permet, pour un document HTML, de cibler un élément grâce à la valeur de son attribut {{htmlattrxref("ID")}}. Il faut que la valeur soit exactement la même que celle du sélecteur pour que l'élément soit effectivement ciblé.

+Un sélecteur d'identifiant (_ID selector_) permet, pour un document HTML, de cibler un élément grâce à la valeur de son attribut {{htmlattrxref("ID")}}. Il faut que la valeur soit exactement la même que celle du sélecteur pour que l'élément soit effectivement ciblé. -
/* L'élément avec l'identifiant id="demo" */
+```css
+/* L'élément avec l'identifiant id="demo" */
 #demo {
   border: red 2px solid;
-}
- -

Syntaxe

+} +``` -
#valeur_identifiant { déclarations }
+## Syntaxe -
-

Note : Cela est équivalent à la notation suivante qui utilise un {{cssxref("Sélecteurs_d_attribut", "sélecteur d'attribut")}}:

+ #valeur_identifiant { déclarations } -
[id=valeur_identifiant] { déclarations }
-
+> **Note :** Cela est équivalent à la notation suivante qui utilise un {{cssxref("Sélecteurs_d_attribut", "sélecteur d'attribut")}}: +> +> [id=valeur_identifiant] { déclarations } -

Exemples

+## Exemples -

CSS

+### CSS -
#identifie {
+```css
+#identifie {
   background-color: blue;
 }
-
- -

HTML

- -
<span id="identifie">Voici un span avec du texte.</span>
-<span>Et un autre (mais sans identifiant).</span>
-
- -

Résultat

- -

{{EmbedLiveSample("Exemples", 200, 50)}}

- -

Spécifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName("CSS4 Selectors", "#id-selectors", "ID selectors")}}{{Spec2("CSS4 Selectors")}} 
{{SpecName("CSS3 Selectors", "#id-selectors", "ID selectors")}}{{Spec2("CSS3 Selectors")}} 
{{SpecName("CSS2.1", "selector.html#id-selectors", "ID selectors")}}{{Spec2("CSS2.1")}} 
{{SpecName("CSS1", "#id-as-selector", "ID selectors")}}{{Spec2("CSS1")}}Définition initiale.
- -

Compatibilité des navigateurs

- -

{{Compat("css.selectors.id")}}

+``` + +### HTML + +```html +Voici un span avec du texte. +Et un autre (mais sans identifiant). +``` + +### Résultat + +{{EmbedLiveSample("Exemples", 200, 50)}} + +## Spécifications + +| Spécification | État | Commentaires | +| -------------------------------------------------------------------------------------------- | ------------------------------------ | -------------------- | +| {{SpecName("CSS4 Selectors", "#id-selectors", "ID selectors")}} | {{Spec2("CSS4 Selectors")}} |   | +| {{SpecName("CSS3 Selectors", "#id-selectors", "ID selectors")}} | {{Spec2("CSS3 Selectors")}} |   | +| {{SpecName("CSS2.1", "selector.html#id-selectors", "ID selectors")}} | {{Spec2("CSS2.1")}} |   | +| {{SpecName("CSS1", "#id-as-selector", "ID selectors")}} | {{Spec2("CSS1")}} | Définition initiale. | + +## Compatibilité des navigateurs + +{{Compat("css.selectors.id")}} -- cgit v1.2.3-54-g00ecf