Within CSS, you can define a color by utilizing a predefined color name.
CSS/HTML accommodate more than 140 standard color names.
You have the ability to define the background color for HTML elements.
Example
<h1 style=”background-color:DodgerBlue;”>Hello World</h1> |
You can specify the color of text.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Example
<h1 style=”color:Tomato;”>Hello World</h1> |
You have the ability to specify the color of borders.
Example
<h1 style=”border:2px solid Tomato;”>Hello World</h1> |
Similarly to specifying colors by name such as “Tomato,” CSS allows for color specification using RGB values, HEX values, HSL values, RGBA values, and HSLA values.
Similar to the color name “Tomato,” but with a 50% transparency.
Example
<h1 style=”background-color:rgb(255, 99, 71);”>…</h1> <h1 style=”background-color:#ff6347;”>…</h1> <h1 style=”background-color:hsl(9, 100%, 64%);”>…</h1> <h1 style=”background-color:rgba(255, 99, 71, 0.5);”>…</h1> <h1 style=”background-color:hsla(9, 100%, 64%, 0.5);”>…</h1> |
Learn more about Color Values In the upcoming chapters, you’ll delve deeper into RGB, HEX, and HSL. |