Back to CSS Notes
Topic #123

Color Keywords

Colour keywords name colours directly, including special values like transparent and currentColor. currentColor keeps borders and icons in sync.


CSS Color Keywords

CSS has some special predefined color keywords that can be used with properties like color, background-color and border-color.

The special keywords are:

  • transparent
  • currentcolor
  • inherit

The transparent Keyword

The transparent keyword is used to make a color transparent. This is often used to make a transparent background color for an element.

Example

  body {
  background-image: url("paper.gif");
}

div {

  background-color: transparent;
}

Note: The transparent keyword is equivalent to rgba(0,0,0,0). RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity for a color. Read more in our CSS RGB chapter and in our CSS Colors chapter.


The currentcolor Keyword

The currentcolor keyword is like a variable that holds the current value of the color property of an element.

This keyword can be useful if you want a specific color to be consistent in an element or a page.

Example

  div {
  color: blue;
  border: 10px solid currentcolor;
}

Example

  body {
  color: purple;
}

div {
  background-color:
  currentcolor;
}

Example

  body {
 color: green;
}

div {
  box-shadow: 0px 0px
  15px currentcolor;
  border: 5px solid currentcolor;
}

The inherit Keyword

The inherit keyword specifies that a property should inherit its value from its parent element.

The inherit keyword can be used for any CSS property, and on any HTML element.

Example

  div {
  border: 2px solid red;
}

span {
  border:
  inherit;
}

Want to go beyond the notes?

Join Coding Now Tech Institute's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Color Keywords – FAQs

Quick answers about learning Color Keywords in CSS.

This free note from Coding Now Tech Institute explains Color Keywords in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on Coding Now Tech Institute, including Color Keywords, is 100% free with no signup required.
With focused practice, most students grasp Color Keywords in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now