본문으로 건너뛰기

hex-color-code

===

id: hex-color-code title: Hex Code description: How to represent colors with hexadecimal hex codes on the web tags:

  • Hex code
  • Color
  • RGB
  • Web Design sidebar_position: 12 isPublic: false

Hex Code

"Hex" is short for "hexadecimal," which represents color values in hexadecimal.


Basic Structure

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

Examples:

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

Composition of Colors

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

For example, 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, you can use hex codes to specify the color of elements.

div {
background-color: #ff5733;
}

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


Short Hex Code

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

Examples:

  • #FFF#FFFFFF (White)
  • #000#000000 (Black)

Follow the asterisked sections in the code for guidance.

다음 내용이 궁금하다면?

월 12,500원 PLUS 멤버십 가입 or 강의를 등록해 주세요!