caret - MDN Web Docs Glossary: Definitions of Web-related terms 编辑
A caret (sometimes called a "text cursor") is an indicator displayed on the screen to indicate where text input will be inserted. Most user interfaces represent the caret using a thin vertical line or a character-sized box that flashes, but this can vary. This point in the text is called the insertion point. The word "caret" differentiates the text insertion point from the mouse cursor.
On the web, a caret is used to represent the insertion point in <input>
and <textarea>
elements, as well as any elements whose contenteditable
attribute is set, thereby allowing the contents of the element to be edited by the user.
Learn more
General knowledge
- Caret navigation on Wikipedia
CSS related to the caret
You can set the color of the caret for a given element's editable content by setting the element's CSS caret-color
property to the appropriate <color>
value.
HTML elements that may present a caret
These elements provide text entry fields or boxes and therefore make use of the caret.
<input type="text">
<input type="password">
<input type="search">
<input type="date">
,<input type="time">
,<input type="datetime">
, and<input type="datetime-local">
<input type="number">
,<input type="range">
<input type="email">
,<input type="tel">
, and<input type="url">
<textarea>
- Any element with its
contenteditable
attribute set
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论