Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
web:html:formulaires:pseudoclass [2023/04/07 11:56] – jcheron | web:html:formulaires:pseudoclass [2023/04/07 15:46] (Version actuelle) – [Validité des données] jcheron | ||
---|---|---|---|
Ligne 9: | Ligne 9: | ||
^:focus | Cible un élément ayant le focus | | ^:focus | Cible un élément ayant le focus | | ||
^:active | Cible un élément activé au clavier ou à la souris | | ^:active | Cible un élément activé au clavier ou à la souris | | ||
+ | ^:required | Cible un élément requis (ayant l' | ||
+ | ^:optional| Cible un élément non requis (opposé de **: | ||
+ | ^:valid | Cible un élément valide (ou n' | ||
+ | ^:invalid | Cible un élément non requis (opposé de **:valid**) | | ||
==== Champs requis ==== | ==== Champs requis ==== | ||
Ligne 45: | Ligne 48: | ||
- | Il est possible d' | + | Il est possible d' |
<sxh html> | <sxh html> | ||
Ligne 101: | Ligne 104: | ||
==== Validité des données ==== | ==== Validité des données ==== | ||
- | L' | + | L' |
**:valid** et **: | **:valid** et **: | ||
Ligne 144: | Ligne 147: | ||
< | < | ||
< | < | ||
- | #form-validation input { | + | #validation-form input { |
width: 200px; | width: 200px; | ||
display: inline-block; | display: inline-block; | ||
} | } | ||
- | #form-validation input + span { | + | #validation-form input + span { |
position: relative; | position: relative; | ||
} | } | ||
- | #form-validation input + span:: | + | #validation-form input + span:: |
position: absolute; | position: absolute; | ||
right: -20px; | right: -20px; | ||
- | top: 5px; | + | top: 0px; |
+ | margin-right: | ||
} | } | ||
- | #form-validation input: | + | #validation-form input: |
- | border: 2px solid red; | + | border: 2px solid #db4764; |
} | } | ||
- | #form-validation input: | + | #validation-form input: |
content: ' | content: ' | ||
- | color: | + | color: |
} | } | ||
- | #form-validation input:valid + span:: | + | #validation-form input:valid + span:: |
content: ' | content: ' | ||
color: green; | color: green; | ||
} | } | ||
+ | # | ||
+ | font-size: 1rem; | ||
+ | position: absolute; | ||
+ | content: " | ||
+ | color: white; | ||
+ | background-color: | ||
+ | padding: 5px 10px; | ||
+ | top: -36px; | ||
+ | left: -70px; | ||
+ | border-radius: | ||
+ | } | ||
+ | |||
</ | </ | ||
- | <div class=" | + | <div class=" |
- | <div id=" | + | <div id="validation-form"> |
- | <label for="prenom">Prénom | + | <label for="nom">Nom *: </ |
- | <input id="prenom" name="prenom" type=" | + | <input id="nom" name="nom" type=" |
< | < | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | < | ||
+ |