HTML · HTML Tutorial · Lesson 12
HTML Colors
Color names, RGB, HEX and HSL values.
HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA or HSLA values.
Example
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="color:MediumSeaGreen;">MediumSeaGreen text</h1>
<h1 style="border:2px solid Violet;">Violet border</h1>
RGB, HEX and HSL
Example
<h1 style="background-color:rgb(255, 99, 71);">rgb(255, 99, 71)</h1>
<h1 style="background-color:#ff6347;">#ff6347</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">hsl(9, 100%, 64%)</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.5);">rgba with 50% opacity</h1>
Keep reading “HTML Colors”
Sign up to read the full lesson (1 more parts), try every example in the live editor, and take the 5-question quiz.