CSS 3之鼠标特效

1. 鼠标箭头

使用 cursor 属性(鼠标指针属性)能实现对鼠标样式的控制;
20220518
例子 1:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>鼠标特效</title>
	</head>
	<body>
		<h2>控制鼠标箭头</h2>
		<div style="font-size: 10px;color: darkblue;">
			<p style="cursor:crosshair ;">精确定位十字效果</p>
			<p style="cursor: hand;">手形效果</p>
			<p style="cursor: help;">帮助效果</p>
			<p style="cursor: wait;">等待效果</p>
			<p style="cursor: move;">移动效果</p>
			<p style="cursor: text;">文本效果</p>
			<p style="cursor: n-resize;">箭头朝上双向效果</p>
			<p style="cursor: s-resize;">箭头朝下双向效果</p>
			<p style="cursor: w-resize;">箭头朝左双向效果</p>
			<p style="cursor: e-resize;">箭头朝右双向效果</p>
			<p style="cursor: ne-resize;">箭头右上双向效果</p>
			<p style="cursor: se-resize;">箭头右下双向效果</p>
			<p style="cursor: nw-resize;">箭头左上双向效果</p>
			<p style="cursor: sw-resize;">箭头左下双向效果</p>
			<p style="cursor:pointer ;">指示效果</p>
		</div>
	</body>
</html>

HTML 鼠标样式效果

2. 鼠标变换效果

例子2:鼠标放在超链接上,能看到超链接的颜色、背景图片发生变换,且鼠标样式变化

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>鼠标手势</title>
		<style type="text/css">
			a{
				display: block;
				background-image: url(img/1.jpg);
				background-repeat: no-repeat;
				width: 120px;
				height: 35px;
				line-height: 30px;
				text-align: center;
				color: #fff;
				text-decoration: none;
			}
			a:hover{
				background-image: url(img/2.jpg);
				color: #ff0000;
				text-decoration: none;
			}
			.help{
				cursor: help;
			}
			.hand{
				cursor: hand;
			}
		</style>
	</head>
	<body>
		<a href="#" class="hand">最新资讯</a>
		<a href="#" class="help">疑难解惑</a>
	</body>
</html>

20220518

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值