Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
  <title>Mouse Pointer Position</title>
  <style>
    #app {
      border: black dashed 1px;
      width: 200px;
      padding: 0 20px 20px 20px;
    }
    #app > div {
      width: 160px;
      height: 80px;
      background-color: lightcoral;
      padding: 20px;
    }
    #app span {
      font-weight: bold;
      font-family: 'Courier New', Courier, monospace;
    }
  </style>
</head>
<body>
<h1>Example: Mouse Pointer Position</h1>
<div id="app">
  <p>Move the mouse pointer over the box below:</p>
  <div v-on:mousemove="mousePos">
    <span>xPos: {{ xPos }}</span><br><span>yPos: {{ yPos }}</span>
  </div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
  const app = Vue.createApp({
    data() {
      return {
        xPos: 0,
        yPos: 0
      }
    },
    methods: {
      mousePos(event) {
        this.xPos = event.offsetX
        this.yPos = event.offsetY
      }