- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- 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 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 Tutorial
- CSS3 - Tutorial
- 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 - Questions and Answers
- CSS - Quick Guide
- CSS - 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
CSS caret-color property specifies the color of the insertion caret, which is the visible marker indicating where the next typed character will be placed. It is also known as the text input cursor.
The caret is found in elements such as <input> or those with contenteditable attribute. This is a thin vertical line, flashing to enhance visibility. It is black by default, but this property allows you to change it.
Possible Values
auto − The user agent chooses a suitable colour for the caret. The color is commonly currentcolor, but the user agent may select for a different one for better visibility, considering currentcolor, background, shadows, and other factors.
Note: Even user agents can use the normally animatable currentcolor for the auto value, it is not interpolated during transitions and animations.
<color> − Color of the caret.
The insertion caret is just one type; browsers may have a navigation caret for non-editable text, while the cursor over text with the auto property or certain elements is not a caret but a cursor. The mouse cursor image appears as a caret when hovering over text with the auto property or over an element with text or vertical-text property, but it is actually a cursor, not a caret.
Applies to
All elements.
Syntax
Keyword Values
caret-color: auto; caret-color: transparent; caret-color: currentcolor;
<color> Values
caret-color: red; caret-color: #5729e9; caret-color: rgb(0 200 0); caret-color: hsl(228deg 4% 24% / 80%);
CSS caret-color - auto Value
The following example demonstrates use of property caret-color: auto. We see input field styled with a default cursor color −
<html> <head> <style> input { caret-color: auto; margin-bottom: 10px; padding: 5px; } </style> </head> <body> <input value="Deafult cursor color." size="65" /> </body> </html>
CSS caret-color - transparent Value
The following example demonstrates the caret-color: transparent property. Here input field is styled with a transparent cursor −
<html> <head> <style> input { caret-color: transparent; margin-bottom: 10px; padding: 5px; } </style> </head> <body> <input value="Transparent cursor." size="65" /> </body> </html>
CSS caret-color - currentcolor Value
The following example demonstrates the caret-color: currentcolor. This sets the color of the cursor to the text color (blue) −
<html> <head> <style> input { color: blue; border: 3px solid black; padding: 5px; caret-color: currentColor; } </style> </head> <body> <input value="Deafult cursor color." size="65" /> </body> </html>
CSS caret-color - <color> Values
The following example demonstartes how to use caret-color property for styling of input elements with different cursor colors −
<html> <head> <style> input { display: block; margin-bottom: 10px; padding: 10px; } .box1 { caret-color: orange; } .box2 { caret-color: #5729e9; } .box3 { caret-color: rgb(241, 245, 20); } .box4 { caret-color: hsla(320, 77%, 58%, 0.8); } </style> </head> <body> <input class="box1" value="The cursor is orange colored." size="65" /> <input class="box2" value="The cursor is blue colored." size="65" /> <input class="box3" value="The cursor is yellow colored." size="65" /> <input class="box4" value="The cursor is pink colored." size="65" /> </body> </html>