Introduction aux couleurs HTML
Cet article explique comment utiliser les couleurs du site Web à l'aide de HTML de manière simple et facile. Les couleurs jouent un rôle important dans la création de sites Web pour se sentir bien. Il n'y a pas de balise HTML intégrée à la place, elle utilise l'attribut style ou la propriété color. Précisément, les couleurs sont incorporées dans les éléments HTML à l'aide de la feuille de style en cascade (CSS). Les couleurs donnent un aspect élégant à la page Web. L'ajout de couleurs à la page Web comprend la définition des couleurs d'arrière-plan, des tableaux, des paragraphes, etc.
Comment définir une couleur d'arrière-plan en HTML?
Rendre la couleur d'arrière-plan plus lumineuse rend le site Web joli et plus audacieux. Cela se fait en utilisant des couleurs, des codes de couleur Hex. Valeurs de couleur RVB et RVBA (valeur alpha 0 à 1).
La couleur hexadécimale est appliquée directement au code Html en utilisant l'attribut Style à l'intérieur de l'élément body du Html. Hex est une combinaison de chiffres et de lettres. Voici un exemple illustrant la couleur d'arrière-plan sur la page Web.
My Sample
HTML BG Color
This page is a demo
My Sample
HTML BG Color
This page is a demo
My Sample
HTML BG Color
This page is a demo
My Sample
HTML BG Color
This page is a demo
Extraits de code:
Pour ajouter une couleur d'arrière-plan, vous pouvez utiliser l'attribut bgcolor pour afficher. Il est compatible avec tous les navigateurs sauf en HTML 5.
Color Name
Hexadecimal
RGB Value
Hexadecimal
RGB Value
Color Name
Hexadecimal
RGB Value
Color Name
Hexadecimal
RGB Value
Hexadecimal
RGB Value
Color Name
Hexadecimal
RGB Value
Color Name
Hexadecimal
RGB Value
Hexadecimal
RGB Value
Comment appliquer la couleur au texte en HTML?
L'application de la couleur au texte HTML est assez facile, nous pouvons ajouter / changer la couleur du texte en appliquant trois façons à savoir la couleur hexadécimale, les valeurs HSL et les noms de couleur. Voici les trois techniques différentes pour appliquer la couleur aux pages Web correspondantes.
1. Noms des couleurs
C'est assez simple en utilisant des noms de couleurs anglais lorsque l'application est simple, ces noms de couleurs sont utilisés. La spécification des noms de couleur est une méthode directe et le W3C a annoncé 16 couleurs de base (noir, jaune, rouge, marron, gris, citron vert, vert, olive, argent, aqua, bleu, bleu marine, blanc, violet, fuchsia, turquoise)
2. HSL
Valeurs de teinte de saturation et de luminosité. La teinte est définie en 0 à 360 degrés, la saturation et la luminosité de 0 à 100%.
3. Couleur hexadécimale
Pour obtenir un résultat précis, un nombre hexadécimal à six chiffres est appliqué. Pour élaborer les deux premiers chiffres désignent le rouge, les deux suivants désignent le vert, les deux autres désignent la valeur bleue et précédés de «#».
L'exemple suivant explique les différentes manières d'appliquer des couleurs aux documents.
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
EDUCBA
h1(
color:#97cae0;
background-color: hsl(200, 50%, 20%);
color: hsl(200, 20%, 90%);
)
h4(
color:rgb(0, 255, 0);
background-color: hsl(130, 10%, 30%);
color: hsl(280, 20%, 80%);
)
li(
color:rgba(12, 88, 120, 1);
background-color: hsl(210, 36%, 50%);
color: hsl(145, 45%, 81%);
)
EDUCBA
List of operating System
Windows
MACINTOSH
LINUX
UBUNTU
Production:
Il existe différentes méthodes pour faire la couleur du texte, car le HTML contient de nombreuses applications personnalisables.
- Application de la section Style
- création d'une feuille de style CSS individuelle
- Envelopper le texte
Comment appliquer la couleur du texte à l'aide de la section?
Voyons différentes méthodes d'utilisation des couleurs HTML:
1. Habillage à l'aide de couleurs HTML
Le code ci-dessous modifie la couleur du texte du paragraphe avec des codes HTML simples. il y a 140 noms colorés pour colorer les sites Web. Le code ci-dessous montre comment appliquer la couleur du texte à l'aide de la section.
Text color
HTML BG Color
changing text color
Text color
HTML BG Color
changing text color
Text color
HTML BG Color
changing text color
Text color
HTML BG Color
changing text color
Ce contenu est très clair
texte de paragraphe rose
Production:
2. Utiliser HEXCOLOR
Encore une fois, cet exemple prend la section style pour déclarer la couleur hexadécimale suivie d'un symbole «#».
Color Picker
changing text color
Color Picker
changing text color
Color Picker
changing text color
Color Picker
changing text color
Bonjour le monde
Texte de paragraphe Hexa
Production:
3. Utilisation de la couleur RVB
Le rouge, le vert, le bleu utilisent 8 bits chacun et leur valeur varie de 0 à 255 ce qui produit différentes couleurs. L'exemple ci-dessous sélectionne la couleur RVB en fonction de ses valeurs.
Color Picker
Texte de paragraphe bleu
Production:
4. Méthode utilisant la feuille de style
Style Sheet in HTML
@import url("/examples/css/style.css");
p (
color: green;
font-size: 26px;
)
The styles for Html documents
Style Sheet in HTML
@import url("/examples/css/style.css");
p (
color: green;
font-size: 26px;
)
The styles for Html documents
Style Sheet in HTML
@import url("/examples/css/style.css");
p (
color: green;
font-size: 26px;
)
The styles for Html documents
Style Sheet in HTML
@import url("/examples/css/style.css");
p (
color: green;
font-size: 26px;
)
The styles for Html documents
Chaque étiquette doit être décorée avec des couleurs.
Production:
5. Création d'un style CSS individuel
fichier .html
CSS style sheet
CSS style sheet
CSS style sheet
Document HTMl multiple.
Bonjour le monde!
Fichier CSS externe lcolor.css
.lcolor ( font-size: 40px;
color:red )
Production:
Comment définir la couleur de la bordure en HTML?
Cela se fait en utilisant un attribut border color = "". Cela se fait en utilisant l'élément Html