Lecture

Hex Code

Hex is short for hexadecimal, which refers to a base-16 numbering system used to represent color values.


Basic Structure

A hex code starts with a # followed by six hexadecimal characters (0-9, A-F).

Examples:

  • #FFFFFF → White
  • #000000 → Black
  • #FF0000 → Red

Components of Color

The six characters in a hex code are grouped into pairs, representing Red (R), Green (G), and Blue (B).

For instance, in the hex code #FF5733:

  • FF represents the intensity of red.

  • 57 represents the intensity of green.

  • 33 represents the intensity of blue.


Usage

In CSS, hex codes can be used to specify the color of elements.

div { background-color: #ff5733; }

The code above sets the background color of the div element to #FF5733.


Short Hex Code

Sometimes, a 3-digit hex code is used to represent colors. This is useful when each color component has the same value.

Examples:

  • #FFF#FFFFFF (White)

  • #000#000000 (Black)


Type the emphasized parts of the code as instructed.

Mission
0 / 1

What is the most appropriate option to fill in the blank?

In `#FF5733`, `FF` represents the intensity of .
red
green
blue
black

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

HTML
CSS
Loading...