CSS之cursor属性

2023-03-05,,

CSS之cursor属性

今天学习了CSS的cursor属性,第一篇博客就用来总结它吧。

cursor属性用于控制光标的显示样式,可取的值有这些:

cursor:url()*|{auto|default|pointer|crosshair|text|vertical-text|help|not-allowed|no-drop|move|e-reszie|s-resize|w-resize|w-resize|n-resize|all-scroll|ne-resize|se-resize|nw-resize|sw-resize|col-resize|row-resize|}

*表示至少写一个该值,url后面可再选{}内的一个值。

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS之cursor属性</title>
<style>
h2#auto{cursor:auto;}
h2#default{cursor:defaut;}
h2#hand{cursor:hand;}
h2#pointer{cursor:pointer;}
h2#text{cursor:text;}
h2#crosshair{cursor:crosshair;}
h2#move{cursor:move;}
h2#wait{cursor:wait;}
h2#progress{cursor:progress;}
h2#help{cursor:help;}
h3#ne-resize{cursor:ne-resize;}
h3#nw-resize{cursor:nw-resize;}
h3#n-resize{cursor:n-resize;}
h3#se-resize{cursor:se-resize;}
h3#sw-resize{cursor:sw-resize;}
h3#s-resize{cursor:s-resize;}
h3#w-resize{cursor:w-resize;}
h3#e-resize{cursor:e-resize;}
h2#vertical-text{cursor:vertical-text;}
h2#not-allowed{cursor:not-allowed;}
h2#no-drop{cursor:no-drop;}
h3#col-resize{cursor: col-resize;}
h3#row-resize{cursor: row-resize;}
h3#all-scroll{cursor:all-scroll;}
h2#url{cursor: url();}
tr{border:1px solid red;}
</style>
</head>
<body>
<a href="http://www.baidu.com" target="_blank">百度</a>
<h1>指示和选择光标</h1>
<h2 id="auto">auto:浏览器默认</h2>
<h2 id="default">default:操作系统默认光标</h2>
<h2 id="hand">hand:手型</h2>
<h2 id="text">text:大写的I,水平文本选择</h2>
<h2 id="vertical-text">vertical-text:大写的I,垂直文本选择</h2>
<h2 id="help">help:箭头加问号,获取帮助</h2>
<h2 id="pointer">pointer:手形,表示链接</h2>
<h2 id="not-allowed">not-allowed:红色圆圈和斜杠,禁止操作</h2>
<h2 id="no-drop">no-drop:红色圆圈和斜杠,无法释放</h2>
<h2 id="crosshair">crosshair:十字瞄准,表示精确选择</h2>
<hr/>
<h1>表程序状态</h1>
<h2 id="wait">wait:选转环,表示等待直到不忙,不能交互</h2>
<h2 id="progress">progress:箭头加旋转环,处理中,可以交互</h2> <hr />
<h1>move用于移动对象</h1>
<h2 id="move">move:移动对象,两端带箭头的十字</h2>
<h3 id="all-scroll">all-scroll:移动</h3>
<h1>在四个角上改变窗口大小</h1>
<h3 id="ne-resize">ne-resize:向东(右)或/和北(上)</h3>
<h3 id="sw-resize">sw-resize:向西(左)或/和南(下)</h3>
<h3 id="nw-resize">nw-resize:向西(左)或/和北(上)</h3>
<h3 id="se-resize">se-resize:向东(右)或/和南(下)</h3>
<hr />
<h1>在四条边上改变窗口大小</h1>
<h2>东西用于改变水平宽度</h2>
<h3 id="e-resize">e-resize:向东(右)</h3>
<h3 id="w-resize">w-resize:向西(左)</h3>
<h2>南北用于改变垂直高度</h2>
<h3 id="s-resize">s-resize:向南(下)</h3>
<h3 id="n-resize">n-resize:向北(上)</h3>
<h3 id="col-resize">col-resize:改变列宽</h3>
<h3 id="row-resize">row-resize:改变行高</h3>
</body>
</html>

还有几个属性值没有弄清楚:hand url col-resize row-resize  弄清楚了再在修改博客。

第一次写博客,各种不熟悉。学的也不够扎实,欢迎指正。

CSS之cursor属性的相关教程结束。

《CSS之cursor属性.doc》

下载本文的Word格式文档,以方便收藏与打印。