css设置光标为拖动

2025-11-06 07:28:21

1、打开html前端开发软件,创建一个html页面,然后在这个页面上创建<div>添加class类,同时输入一些文字。

代码:<div class="move">鼠标放上,鼠标指针变为可拖动</div>

css设置光标为拖动

2、设置cursor: move。创建<style>标签,然后对move类添加cursor: move属性。如图:

代码:

<style type="text/css">

.move{

cursor: move;

}

</style>

css设置光标为拖动

3、保存html页面后使用浏览器打开,鼠标移动到<div>上即可看到效果。

页面所有代码:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style type="text/css">

.move{

cursor: move;

}

</style>

</head>

<body>

<div class="move">鼠标放上,鼠标指针变为可拖动</div>

</body>

</html>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢