.
3ss.cn

css怎么样改变鼠标形状

css改变鼠标形状的方法是,在指定元素上添加cursor属性,并将属性值设置为需要的值,如pointer、move、text等,具体代码如【<span style="cursor:pointer">Pointer</span>】。

css给我们提供了一个非常好用的属性,它就是cursor属性,下面让我们来一起看看这个属性。

cursor 属性规定要显示的光标的类型(形状)。

常用的一些属性值:

default 默认光标(通常是一个箭头)

auto 默认。浏览器设置的光标。

crosshair 光标呈现为十字线。

pointer 光标呈现为指示链接的指针(一只手)

move 此光标指示某对象可被移动。

text 此光标指示文本。

wait 此光标指示程序正忙(通常是一只表或沙漏)。

help 此光标指示可用的帮助(通常是一个问号或一个气球)。

代码示例:

<html>

<body>
<p>请把鼠标移动到单词上,可以看到鼠标指针发生变化:</p>
<span style="cursor:auto">
Auto</span><br />
<span style="cursor:crosshair">
Crosshair</span><br />
<span style="cursor:default">
Default</span><br />
<span style="cursor:pointer">
Pointer</span><br />
<span style="cursor:move">
Move</span><br />
<span style="cursor:e-resize">
e-resize</span><br />
<span style="cursor:ne-resize">
ne-resize</span><br />
<span style="cursor:nw-resize">
nw-resize</span><br />
<span style="cursor:n-resize">
n-resize</span><br />
<span style="cursor:se-resize">
se-resize</span><br />
<span style="cursor:sw-resize">
sw-resize</span><br />
<span style="cursor:s-resize">
s-resize</span><br />
<span style="cursor:w-resize">
w-resize</span><br />
<span style="cursor:text">
text</span><br />
<span style="cursor:wait">
wait</span><br />
<span style="cursor:help">
help</span>
</body>

</html>

大家可以复制上面的到本地去运行,看看具体的运行效果。

赞(0)
未经允许不得转载:互联学术 » css怎么样改变鼠标形状

评论 抢沙发