可以使用 JavaScript 在网页中跟随鼠标移动。下面是一个例子:
<html>
<head>
<style>
#box {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
}
</style>
</head>
<body>
<div id="box"></div>
<script>
document.addEventListener("mousemove", function(event) {
var x = event.clientX;
var y = event.clientY;
document.getElementById("box").style.top = y + "px";
document.getElementById("box").style.left = x + "px";
});
</script>
</body>
</html>
这段代码会在页面中创建一个红色的正方形,并使它跟随鼠标的移动而移动。
希望这对你有帮助!