CSS Color Keywords


This page is here to tell you about some special words: transparent, currentcolor and inherit.

The transparent Keyword

The term transparent means making a color see-through. People often use it to make the background color of something see-through.

Example

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

div {
  background-color: transparent;
}
Try it Yourself »

Note: The word transparent means the same as rgba(0,0,0,0). RGBA colors are like RGB colors but with an extra part called alpha that tells you how see-through the color is. To learn more, check out our CSS RGB and CSS Colors chapters.


The currentcolor Keyword

In HTML, currentcolor is like a box that holds the current color used for an element's color property.

This term is useful when you want to maintain a consistent color for a section of a website or an entire web page.

Example

div {
  color: blue;
  border: 10px solid currentcolor;
}
Try it Yourself »

Example

body {
  color: purple;
}

div {
  background-color: currentcolor;
}
Try it Yourself »

Example

body {
 color: green;
}

div {
  box-shadow: 0px 0px 15px currentcolor;
  border: 5px solid currentcolor;
}
Try it Yourself »

The inherit Keyword

In HTML, when we say inherit it means that a property should use the same value as its parent element.

In CSS, you can use the inherit keyword with any HTML element and for any property.

Example

div {
  border: 2px solid red;
}

span {
  border: inherit;
}
Try it Yourself »