Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App
Next Article:
CSS Colors
Next article icon

CSS Color Keywords

Last Updated : 09 Jan, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

CSS Color Keywords provide some special color keywords with their specific meanings. There are 3 different possible approaches through which the Color can be defined, i.e., the transparent, currentcolor, and inherit keywords.

Table of Content

  • Transparent Keyword
  • Currentcolor Keyword
  • Inherit Keyword

Transparent Keyword

To make the color as Transparent, the Transparent Keyword can be used, which makes the background color as transparent for an element. The transparent keyword is equivalent to rgba(0,0,0,0).

Syntax

element {
background-color: transparent;
}

Example: The example illustrates the CSS Color Keywords transparent.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width,                     initial-scale=1.0">     <style>         div {             background-color: transparent;             border: 2px solid black;             height: 50px;         }          body {             background-color: rgb(165, 220, 165);         }          p {             background-color: rgb(238, 238, 249);             height: 50px;         }     </style> </head>  <body>     <h1>GeeksforGeeks</h1>     <div>         The element having         transparent color keyword     </div>     <p>         The element have         background-color     </p> </body>  </html> 

Output:

key

Currentcolor Keyword

The currentcolor defines the value of the color property of the element that allows you to use the current text color for other properties. If the specific used color needs to be consistent for the entire web page or the element, then this keyword will be beneficial to use.

Syntax

element {
color: crimson;
border: 2px solid currentcolor;
}

Example: The example illustrates the CSS Color Keywords currentcolor.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width,                     initial-scale=1.0">     <style>         div {             background-color: rgb(165, 220, 165);             border: 2px solid black;             height: 50px;         }          p {             color: rgb(211, 101, 158);             border: 5px solid currentColor;             height: 50px;         }     </style> </head>  <body>     <h1>GeeksforGeeks</h1>     <div>         The element having         currentcolor color keyword     </div>     <p>         The element have         background-color     </p> </body>  </html> 

Output:

keyword

Inherit Keyword

To inherit the value of the property from its parent element, the inherit keyword will be beneficial to use. This property can be used either with CSS property or the HTML element.

Syntax

element {
border: inherit;
}

Example: The example illustrates the CSS Color Keywords transparent.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport"            content="width=device-width,                     initial-scale=1.0">     <title>HTML Color Keyword</title>     <style>         div {             border: 2px solid rgb(165, 220, 165);         }          p {             border: inherit;         }     </style> </head>  <body>     <h1>GeeksforGeeks</h1>     <div>         The element having         inherit color keyword         <p>             The element have             background-color         </p>     </div> </body>  </html> 

Output

inkey

Next Article
CSS Colors

S

shivanigupta18rk
Improve
Article Tags :
  • Web Technologies
  • CSS

Similar Reads

  • W3.CSS Colors
    W3.CSS provides us with classes to set the color of font and container. Not only this, there are also classes to change or set the color of the font or container on hover the division or section. All the coloring elements can be broadly be classified into the following parts: Background ColorText Co
    6 min read
  • Primer CSS Colors
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. It is highly reusable and flexible. I
    7 min read
  • CSS | unset keyword
    The CSS unset keyword is an inbuilt keyword in CSS. The CSS unset keyword is an inbuilt keyword in CSS which has been used to unset the cascading style to its parent element. It behaves like the inherit keyword in the first case, and like the initial keyword in the second caseSyntax: property: unset
    1 min read
  • CSS color Property
    The color property is used to specify the text color. It accepts color values as color name, HEX, RGB, RGBA, HSL, or HSLA values. This property plays a crucial role in defining text appearance, ensuring readability, and enhancing the overall design aesthetics of web content. Syntaxcolor: color | ini
    3 min read
  • CSS Colors
    CSS colors are used to set the color of different parts of a webpage, like text, background, and borders. This helps make the page look more attractive and easier to read. You can define colors using names, hex codes, RGB values, and more. You can try different formats of colors here- #content-ifram
    6 min read
  • CSS currentcolor Keyword
    The currentcolor keyword in CSS allows you to reference the current value of the color property for other CSS properties, such as background-color, border-color, box-shadow, etc. This simplifies styling, as you can apply the same color in multiple places without needing to explicitly redefine it. Wh
    2 min read
  • Materialize CSS Colors
    It is created with HTML, CSS, and JavaScript, and designed by Google. Material Design is a design language that combines the classic principles of successful design along with innovation and technology. Color: Here is a color palette based on the material design base colors. Each of these colors is
    2 min read
  • Primer CSS Alerts Color
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    2 min read
  • Tailwind CSS Text Color
    This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. By using this class we can color any text. In CSS, we do that by using the CSS Color property. Text Color classes: text-transparent: The text color will be transparent.text-current: The text color
    2 min read
  • CSS 6 Digit Hex Color
    The Six Digit Hex Color is very much popular to define colors in CSS because of the variation of multiple colors available in the 6-digit hex colors codes. There are Six characters followed by a hash(#) like #RRGGBB. The developer used the hex color codes it is hard enough to remember those to compa
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences