300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > CSS-鼠标样式的设置 手形 移动 禁用 文本等

CSS-鼠标样式的设置 手形 移动 禁用 文本等

时间:2022-12-15 06:57:55

相关推荐

CSS-鼠标样式的设置 手形 移动 禁用 文本等

在 CSS 中可以通过cursor样式属性来设置光标的样式;比如放在链接上的样式,光标在文本上的样式,移动时的样式等

ul li {width: 200px;height: 50px;/* 元素水平居中 */margin: 0 auto;/* 单行文本垂直居中 */line-height: 50px;}/* 默认 */ul li:nth-child(1):hover {cursor: default;background-color: red;}/* 小手 */ul li:nth-of-type(2):hover {cursor: pointer;background-color: green;}/* 移动时的样式 */ul li:nth-of-type(3):hover {cursor: move;background-color: blue;}/* 文本光标 */ul li:nth-of-type(4):hover {cursor: text;background-color: skyblue;}/* 禁止 */ul li:nth-of-type(5):hover {cursor: not-allowed;background-color: wheat;}

<ul><li>默认样式</li><li>小手</li><li>移动时的样式</li><li>文本光标</li><li>禁止时的样式</li></ul>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。