Curriculum
Course: CSS
Login

Curriculum

CSS

CSS INTRODUCTION

0/1

CSS Selectors

0/1

CSS Comments

0/1

CSS Padding

0/1

CSS Box Model

0/1

CSS Combinators

0/1

CSS Pseudo-classes

0/1

CSS Pseudo-elements

0/1

CSS Dropdowns

0/1

CSS Image Gallery

0/1

CSS Image Sprites

0/1

CSS Counters

0/1

CSS Website Layout

0/1

CSS Specificity

0/1

CSS Math Functions

0/1
Text lesson

Colors

CSS Color Names

Within CSS, you can define a color by utilizing a predefined color name.

IMG_3327 2

CSS/HTML accommodate more than 140 standard color names.

IMG_3328

CSS Background Color

You have the ability to define the background color for HTML elements.

IMG_3329

Example

<h1 style=”background-color:DodgerBlue;”>Hello World</h1>
<p style=”background-color:Tomato;”>Lorem ipsum…</p>

CSS Text Color

You can specify the color of text.

Hello World

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>
<p style=”color:DodgerBlue;”>Lorem ipsum…</p>
<p style=”color:MediumSeaGreen;”>Ut wisi enim…</p>

CSS Border Color

You have the ability to specify the color of borders.

IMG_3330

Example

<h1 style=”border:2px solid Tomato;”>Hello World</h1>
<h1 style=”border:2px solid DodgerBlue;”>Hello World</h1>
<h1 style=”border:2px solid Violet;”>Hello World</h1>

CSS Color Values

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.

IMG_3331

Similar to the color name “Tomato,” but with a 50% transparency.

IMG_3332

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.