
通过 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”、链接上的“手”等。 |
| 十字线 | 十字线或加号 |
| 默认 | 箭头 |
| 指针 | 一只指向的手(在 IE 4 中该值为手)。 |
| 移动 | “I”栏 |
| e-resize | 光标指示框的边缘将向右(东)移动。 |
| ne-resize | 光标指示框的边缘将向上和向右移动(北/东)。 |
| nw-resize | 光标指示框的边缘将向上和向左移动(北/西)。 |
| n-resize | 光标指示框的边缘要向上(向北)移动。 |
| se-resize 立即学习“前端免费学习笔记(深入)”; |
光标指示框的边缘向下和向右移动(南/东)。 |
| sw-resize | 光标指示框的边缘向下和向左移动(南/西)。 |
| s-resize | 光标指示框的边缘向下移动(向南) ). |
| w-resize | 光标指示框的边缘向左(向西)移动). |
| 文本 | I 栏。 |
| 等待 | 一个沙漏。 |
| 帮助 | 问号或气球,非常适合在帮助按钮上使用。 |
| <url> | 光标图像文件来源。 |
以上就是CSS 光标属性示例的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号