目录

CSS - Cursors

CSS的cursor属性允许您指定应向用户显示的游标类型。

这个属性的一个很好的用法是在表单上使用图像提交按钮。 默认情况下,当光标悬停在链接上时,光标会从指针变为手形。 但是,它不会更改表单上的提交按钮的表单。 因此,每当有人将鼠标悬停在作为提交按钮的图像上时,它就会提供图像可点击的视觉线索。

下表显示了cursor属性的可能值 -

Sr.No. 价值和描述
1

auto

光标的形状取决于它结束的上下文区域。 例如,我在文本上,在链接上移动,等等......

2

crosshair

十字准线或加号

3

default

一个箭头

4

pointer

指针(在IE 4中这个值是手)

5

move

我吧

6

e-resize

光标指示框的边缘要向右移动(向东)

7

ne-resize

光标指示框的边缘向上和向右移动(北/东)

8

nw-resize

光标指示框的边缘向上和向左移动(北/西)

9

n-resize

光标指示框的边缘向上移动(北)

10

se-resize

光标指示框的边缘向下和向右移动(南/东)

11

sw-resize

光标指示框的边缘向下和向左移动(南/西)

12

s-resize

光标指示框的边缘向下移动(向南)

13

w-resize

光标指示框的边缘向左(西)移动

14

text

我吧

15

wait

一小时玻璃

16

help

问号或气球,非常适合在帮助按钮上使用

17

《url》

光标图像文件的来源

NOTE - 您应该尝试仅使用这些值为用户添加有用的信息,并且在某些地方,他们希望看到该光标。 例如,当某人悬停在链接上时使用十字准线可能会使访问者感到困惑。

这是一个例子 -

<html>
   <head>
   </head>
   <body>
      <p>Move the mouse over the words to see the cursor change:</p>
      <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> 

它会产生以下结果 -

新页面打开
<上一篇.CSS - Padding
↑回到顶部↑
WIKI教程 @2018