HTML Colors

ЁЯУШ Basic рдЬрд╛рдирдХрд╛рд░реА HTML Colors рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ

HTML рдореЗрдВ Colors рдХрд╛ рдЙрдкрдпреЛрдЧ webpage рдХреЛ рдЖрдХрд░реНрд╖рдХ рдФрд░ readable рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред рдЖрдк рдХрд┐рд╕реА рднреА text, background, border, рдпрд╛ element рдореЗрдВ colors рдЬреЛрдбрд╝ рд╕рдХрддреЗ рд╣реИрдВред


ЁЯОп HTML рдореЗрдВ Color рдХреИрд╕реЗ Apply рд╣реЛрддрд╛ рд╣реИ?

HTML рдореЗрдВ colors рдХреЛ рдЖрдорддреМрд░ рдкрд░ CSS (Cascading Style Sheets) рдХреЗ рдорд╛рдзреНрдпрдо рд╕реЗ apply рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред

рдЖрдк colors рдЗрди рддрд░реАрдХреЛрдВ рд╕реЗ specify рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ:

  1. Color Name (рдЬреИрд╕реЗ – red, blue, green)
  2. RGB value (рдЬреИрд╕реЗ – rgb(255,0,0))
  3. HEX value (рдЬреИрд╕реЗ – #FF0000)
  4. HSL value (рдЬреИрд╕реЗ – hsl(0, 100%, 50%))
  5. RGBA / HSLA (alpha transparency рдХреЗ рд╕рд╛рде)

рдЗрд╕ chapter рдореЗрдВ рд╣рдо Color Name method рдкрд░ рдлреЛрдХрд╕ рдХрд░реЗрдВрдЧреЗред


ЁЯФ╣ 1. Color Name рдХрд╛ рдЙрдкрдпреЛрдЧ

HTML рдореЗрдВ predefined 140+ color names рд╣реЛрддреЗ рд╣реИрдВред рдпреЗ colors browser рджреНрд╡рд╛рд░рд╛ рдкрд╣рдЪрд╛рди рд▓рд┐рдП рдЬрд╛рддреЗ рд╣реИрдВ рдФрд░ рдЖрдк рдЗрдиреНрд╣реЗрдВ рд╕реАрдзрд╛ use рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред

тЬЕ Syntax:

<p style="color: red;">рдпрд╣ рд▓рд╛рд▓ рд░рдВрдЧ рдореЗрдВ рд╣реИ</p>

ЁЯз╛ Example: Text Color with Color Name

<h3 style="color: blue;">This is Blue Text</h3>
<p style="color: green;">This paragraph is in Green</p>
<p style="color: orange;">Orange is a bright color!</p>

ЁЯЦе Output:

This is Blue Text
This paragraph is in Green
Orange is a bright color!


ЁЯз╛ Example: Background Color

<body style="background-color: lightgray;">
  <h2 style="color: navy;">Welcome to My Website</h2>
</body>

ЁЯЦе Output:

(Page background will be light gray, and heading text will be navy)


ЁЯУЛ Common Color Names

Color NameOutput
red#ff0000 red
green#008000 green
blue#0000ff blue
black#000000 black
white#ffffff white
gray#808080 gray
orange#ffa500 orange
pink#ffc0cb pink
purple#800080 purple
yellow#ffff00 yellow

ЁЯзк Practice Task

  1. рдПрдХ HTML рдкреЗрдЬ рдмрдирд╛рдПрдВ рдЬрд┐рд╕рдореЗрдВ:
    • рдПрдХ heading рд╣реЛ “Color Demo”
    • 5 paragraphs рд╣реЛрдВ, рд╣рд░ рдПрдХ рдЕрд▓рдЧ color рдореЗрдВ
    • рдПрдХ paragraph рдРрд╕рд╛ рд╣реЛ рдЬрд┐рд╕рдХреА background рдФрд░ text color рджреЛрдиреЛрдВ set рд╣реЛрдВ

ЁЯСЙ Hint:

<p style="color: white; background-color: black;">This is white on black</p>

ЁЯФЪ Conclusion: