Introducere pe culorile HTML
Acest articol acoperă modul de utilizare a culorilor din site-ul web folosind HTML în moduri simple și simple. Culorile joacă un rol important în crearea de site-uri web pentru a arăta și a se simți bine. Nu există o etichetă individuală HTML încorporată, ci folosește atributul stil sau proprietatea culorii. Mai precis, culorile sunt încorporate în elementele HTML folosind Cascading Style Sheet (CSS). Culorile oferă aspect elegant paginii web. Adăugarea culorilor pe pagina web include setarea culorilor de fundal, tabelelor, alineatelor etc.
Cum să setați o culoare de fundal în HTML?
Crearea de culoare de fundal luminează face site-ul web să arate destul de mai îndrăzneț. Se realizează folosind culori, coduri de culori Hex. Valori de culoare RGB și RGBA (valoarea Alpha 0 până la 1).
Culoarea hexagonală este aplicată direct codului Html folosind atributul Style din interiorul elementului corpului Html. Hex este o combinație de numere și litere. Mai jos este prezentat exemplul care ilustrează culoarea de fundal pe pagina 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
Fragmente de cod:
Pentru a adăuga culoare de fundal puteți utiliza atributul bgcolor pentru afișare. Este compatibil cu toate browserele, cu excepția 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
Cum se aplică culoarea textului în HTML?
Aplicarea culorii textului HTML este destul de ușoară, putem adăuga / schimba culoarea textului prin aplicarea a trei moduri, respectiv culoare Hex, valori HSL și nume de culoare. Următoarele sunt cele trei tehnici diferite pentru aplicarea culorii pe paginile web corespunzătoare.
1. Numele culorilor
Acest lucru este destul de simplu folosind nume de culori în limba engleză atunci când aplicația este directă, aceste nume de culori sunt utilizate. Precizarea numelor de culori sunt metode directe, iar W3C a anunțat 16 culori de bază (negru, galben, roșu, maroniu, gri, var, verde, măslin, argint, acvatic, albastru, bleumarin, alb, purpuriu, fuchsia, teal)
2. HSL
Saturația nuanțelor și valorile culorii ușoare. Nuanța este definită în 0 până la 360 de grade, saturație și ușurință de la 0 la 100%.
3. Culoare hex
Pentru a obține un rezultat precis, se aplică un număr hexadecimal de șase cifre. Pentru a elabora primele două cifre se indică roșu, următoarele două notează verde, celelalte două denotă valoare albastră și precedate de „#”.
Următorul exemplu explică diferitele moduri de aplicare a culorilor la documente.
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
ieşire:
Există diferite metode pentru a face culoarea textului, deoarece HTML are o mulțime de aplicații personalizabile.
- Aplicarea secțiunii Style
- crearea unei foi de stil CSS individuale
- Înfășurarea textului
Cum se aplică culoarea textului folosind secțiunea?
Să vedem diverse metode de utilizare a culorilor HTML:
1. Înfășurare folosind culori HTML
Codul de mai jos schimbă culoarea textului din paragraf cu coduri HTML simple. Există 140 de nume colorate pentru a colora site-urile web. Codul de mai jos arată cum se aplică culoarea textului folosind secțiunea.
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
Acest conținut este foarte clar
text de paragraf roz
ieşire:
2. Folosind HEXCOLOR
Din nou, acest exemplu ia secțiunea de stil pentru a declara culoarea hexagonală urmată de un simbol '#'.
Color Picker
changing text color
Color Picker
changing text color
Color Picker
changing text color
Color Picker
changing text color
Salut Lume
Hexa paragraf text
ieşire:
3. Folosind culoarea RGB
Roșu, verde, albastru folosește 8 biți fiecare, iar valoarea lor variază de la 0 la 255, ceea ce produce diverse culori. Exemplul de mai jos alege culoarea RGB după valorile lor.
Color Picker
Text de paragraf albastru
ieşire:
4. Metoda utilizând foaia de stil
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
Fiecare etichetă trebuie să fie stilată cu culori.
ieşire:
5. Crearea stilului CSS individual
fișier .html
CSS style sheet
CSS style sheet
CSS style sheet
Document multiplu HTMl.
Salut Lume!
Fișier CSS extern lcolor.css
.lcolor ( font-size: 40px;
color:red )
ieşire:
Cum să setați culoarea chenarului în HTML?
Se realizează folosind un chenar de atribut color = "". Se realizează folosind elementul Html