Afin d'obtenir un effet spécial, nous devons utiliser Javascript pour modifier dynamiquement l'attribut CSS d'une certaine balise. Par exemple : lorsque la souris passe sur une image, on ajoute une bordure à l'image. Le code peut être le suivant :
derrière le style en JavaScript Quelles devraient être les propriétés de ?
| Comparaison des étiquettes et des attributs | |
|---|---|
| Syntaxe CSS (insensible à la casse) | Syntaxe JavaScript (sensible à la casse) |
| border | border |
| border-bottom | borderBottom |
| border-bottom-color | borderBottomColor |
| border-bottom-style | borderBottomStyle |
| border-bottom-width | borderBottomWidth |
| border -color | borderColor |
| border-left | borderLeft |
| border-left-color | borderLeftColor |
| border-left-style | borderLeftStyle |
| border-left-width | borderLeftWidth |
| border-right | borderRight |
| border-right-color | borderRightColor |
| border-right-style | borderRightStyle |
| border-right-width | borderRightWidth |
| border- style | borderStyle |
| border-top | borderTop |
| border-top-color | borderTopColor |
| border-top-style | borderTopStyle |
| border-top-width | borderTopWidth |
| border-width | borderWidth |
| clear | clear |
| float | floatStyle |
| marge | marge | marge
| -inférieure | marge inférieure marge | gauche
| marge | gauche |
| marge droite | marge | droite
| supérieure | |
| remplissage | supérieur |
| rembourrage rembourrage | |
| - | rembourrage | inférieurRembourrage
| rembourrage | gaucheRembourrage gauche |
| -rembourrage droitRembourrage | droit |
| - | rembourrage | supérieurHaut
| Comparaison des étiquettes et des attributs de couleur et d'arrière-plan | |
| Syntaxe CSS (insensible à la casse) | Syntaxe JavaScript (sensible à la casse) |
| background | background |
| background-attachment | backgroundAttachment |
| background-color | backgroundColor |
| background-image | backgroundImage |
| background-position | backgroundPosition |
| background-repeat | backgroundRépéter |
| couleur | couleur |
| Les balises et attributs de style se comparent à | |
| la syntaxe CSS (insensible à la casse) | La syntaxe JavaScript (sensible à la casse) |
| display | display |
| list-style-type | listStyleType |
| list-style-image | listStyleImage |
| list-style-position | listStylePosition |
| list-style | listStyle |
| white-space | whiteSpace |
| Les balises et attributs de style de texte se comparent à | |
| la syntaxe CSS (insensible à la casse) | à la syntaxe JavaScript (sensible à la casse) |
| font | font |
| font-family | fontFamily |
| font-size | fontSize |
| font-style | fontStyle |
| font-variant | fontVariant |
| font-weight | fontWeight |
| Comparaison des étiquettes de texte et des attributs | |
| Syntaxe CSS (insensible à la casse) | Syntaxe JavaScript (sensible à la casse) |
| espacement des lettres | letterSpacing |
| line-break | lineBreak |
| line-height | lineHeight |
| text-align | textAlign |
| text-decoration | textDecoration |
| text-indent | textIndent |
| text-justify | textJustify |
| text- transform | textTransformer |
| verticalement-aligner | verticalAlign |