星空网 > 软件开发 > 网页设计

CSS光标cursor

×
目录
[1]定义 [2]标准样式 [3]拓展样式 [4]私有样式 [5]定义样式 [6]常见应用

前面的话

  在浏览器中,光标对于提供交互反馈很有用。通过在不同的场景中改变光标,就能赋予其不同的含义。

 

定义

  cursor光标

  值: [<uri>,]*[auto | default | pointer | crosshair | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress]] | inherit

  初始值: auto

  应用于: 所有元素

  继承性: 有

 

标准样式

  CSS2提供了相对较少的选择

url: 自定义光标的URLdefault: 默认光标,通常是一个箭头auto: 浏览器自动识别的光标crosshair : 十字线pointer: 手型指针move: 移动指针e-resize: 向东移动指针ne-resize: 向东北移动指针nw-resize: 向西北移动指针n-resize: 向北移动指针se-resize: 向东南移动指针sw-resize: 向西南移动指针s-resize: 向南移动指针w-resize: 向西移动指针text: 文本指针wait: 指示程序正忙help: 帮助指针

拓展样式

  CSS3增加了更多的cursor的样式值

  [注意]所有拓展样式IE7-浏览器都不支持

cursor:none (not IE8, Safari)cursor:context-menu (not Safari,Firefox,Chrome)cursor:cell (not Safari)cursor:alias (not Safari)cursor:copy (not IE,Safari)cursor:grab (not IE,Safari,Chrome)cursor:grabbing (not IE,Safari,Chrome)cursor:zoom-in (not IE,Safari)cursor:zoom-out (not IE,Safari)cursor:vertical-textcursor:no-dropcursor:not-allowedcursor:all-scrollcursor:ew-resizecursor:ns-resizecursor:nesw-resizecursor:nwse-resizecursor:col-resizecursor:row-resize

私有样式

  有些浏览器还提供了增加浏览器前缀的私有样式

  [注意]safari将-webkit-grab和-webkit-grabbing都解释为default

cursor:-webkit-grab; cursor: -moz-grab;cursor:-webkit-grabbing; cursor: -moz-grabbing;cursor:-webkit-zoom-in; cursor: -moz-zoom-in;cursor:-webkit-zoom-out; cursor: -moz-zoom-out;  

自定义样式

  所有浏览器都支持使用后缀名为.cur的文件,chrome、firefox、safari还支持使用普通图片制作光标

  [注意]使用URL自定义样式,后面必须跟有一个逗号和某个通用关键字

//错误cursor: url('m.cur');//正确cursor: url('m.cur'),auto;

常见应用

  链接的默认光标是手型指针pointer,通过光标的变化可以让访问者清楚的知道该元素是可点击的

  元素的title属性用来提供元素的额外信息,配合help光标可以得到更好的表现方式

span[title]{  cursor: help;  border-bottom: 1px solid gray;}

<div><span title="Cascading Style Sheets">CSS</span> is much too interesting</div>




原标题:CSS光标cursor

关键词:CSS

CSS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

美国靠谱的海外仓:https://www.goluckyvip.com/tag/38296.html
美国空卡专线:https://www.goluckyvip.com/tag/38297.html
美国空派:https://www.goluckyvip.com/tag/38298.html
美国空派fba:https://www.goluckyvip.com/tag/38299.html
站外流量获取:https://www.goluckyvip.com/tag/383.html
库存积压:https://www.goluckyvip.com/tag/3830.html
【再放信号】美国Etsy即将放开中国卖家入驻,官方邮件你收到了吗?:https://www.kjdsnews.com/a/1836640.html
安庆市周边免费景点 安庆免费游玩的地方有哪些?:https://www.vstour.cn/a/365186.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流