
- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Advanced Features
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - caret-color Property
CSS caret-color property specifies the color of the cursor, which is the visible marker, also known as the text input cursor. It is used with input elements such as input forms, text boxes, textarea etc. which use the cursor and are editable.
Syntax
caret-color: auto | color | transparent | initial | inherit;
Property Values
Value | Description |
---|---|
auto | The browser uses the currentColor for the caret. Default. |
color | The color of the caret can be specified in different formats (color names, hex, rgb etc.). |
transparent | The caret is not visible. |
initial | It sets the property to its default value. |
inherit | It inherits the property from the parent element. |
Examples of CSS Caret Color Property
The following examples explain the caret-color property with different values.
Caret Color Property with Auto Value
To let the browser decide the color of the cursor, which uses the current text color, we use the auto value. The current text color will be applied to the cursor. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> div { display: grid; gap: 20px; width: 60%; } .inp { border: 2px solid black; font-size: 16px; padding: 5px; caret-color: auto; } .text { color: blue; } .textarea { color: red; } </style> </head> <body> <h2> CSS caret-color property </h2> <div> <label> caret-color: auto (color of the text will be applied to caret) </label> <input type="text" value="Default cursor color." class=" inp text" /> <textarea rows="10" class=" inp textarea">Default caret color. </textarea> </div> </body> </html>
Caret Color Property with Color Values
To give a color of our choice to the cursor, we can specify the color in different format (color names, hex values, rgb values, hsl values etc.). The specified color will be applied to the cursor. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> div { display: grid; gap: 20px; width: 60%; } .inp { border: 2px solid black; font-size: 20px; padding: 5px; } .text1 { caret-color: orange; } .text2 { caret-color: #ff4d94; } .text3 { caret-color: rgb(0, 204, 204); } .textarea { caret-color: hsl(120, 100%, 50%); } </style> </head> <body> <h2> CSS caret-color property </h2> <div> <label> caret-color: color values (specified color will be applied to caret.) </label> <input type="text" value="Green caret color." class=" inp text1" /> <input type="text" value="Pink cursor color." class=" inp text2" /> <input type="text" value="Blue cursor color." class=" inp text3" /> <textarea rows="10" class=" inp textarea">green cursor color. </textarea> </div> </body> </html>
Caret Color Property with Transparent Value
To make the cursor transparent such that it is not visible, we use the transparent value. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> div { display: grid; gap: 20px; width: 60%; } .inp { border: 2px solid black; font-size: 16px; padding: 5px; caret-color: transparent; } </style> </head> <body> <h2> CSS caret-color property </h2> <div> <label> caret-color: transparent (cursor color will not be visible) </label> <input type="text" value="transparent caret." class="inp" /> <textarea rows="10" class=" inp">transparent caret. </textarea> </div> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
caret-color | 57.0 | 79.0 | 53.0 | 11.1 | 44.0 |