CSS 光标属性示例

cssweb developmentfront end technology更新于 2024/9/7 4:28:17

使用 CSS 光标属性,您可以显示十字准线、加号、指针等。您可以尝试运行以下代码在 CSS 中实现光标属性 −

示例

<html>
   <head>
   </head>
   <body>
      <div style = "cursor:auto">Auto</div>
      <div style = "cursor:crosshair">Crosshair</div>
      <div style = "cursor:default">Default</div>
      <div style = "cursor:pointer">Pointer</div>
      <div style = "cursor:move">Move</div>
      <div style = "cursor:e-resize">e-resize</div>
      <div style = "cursor:ne-resize">ne-resize</div>
      <div style = "cursor:nw-resize">nw-resize</div>
      <div style = "cursor:n-resize">n-resize</div>
      <div style = "cursor:se-resize">se-resize</div>
      <div style = "cursor:sw-resize">sw-resize</div>
      <div style = "cursor:s-resize">s-resize</div>
      <div style = "cursor:w-resize">w-resize</div>
      <div style = "cursor:text">text</div>
      <div style = "cursor:wait">wait</div>
      <div style = "cursor:help">help</div>
   </body>
</html>

我们在上方添加了以下值 −

值
描述
auto
光标的形状取决于它所在的上下文区域。例如,文本上方是"I",链接上方是"手",等等。
crosshair
A crosshair or plus sign
default
An arrow
pointer
A pointing hand (in IE 4 this value is hand).
move
The 'I' bar
e-resize
The cursor indicates that an edge of a box is to be moved right (east).
ne-resize
光标指示框的边缘将向上和向右移动(北/东)。
nw-resize
光标指示框的边缘要向上和向左移动(北/西)。
n-resize
光标指示框的边缘要向上(北)移动。
se-resize

光标指示框的边缘将向下和向右(南/东)移动。
sw-resize
光标指示框的边缘将向下和向左(南/西)移动。
s-resize
光标指示框的边缘要向下(南)移动。
w-resize
光标指示框的边缘将向左(西)移动。
text
The I bar.
wait
An hour glass.
help
问号或气球,最适合用于帮助按钮。
<url>
光标图像文件的来源。

相关文章


有用资源