The width read-only property of the PointerEvent interface represents the width of the pointer's contact geometry along the x-axis, measured in CSS pixels. Depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value.

If the input hardware cannot report the contact geometry to the browser, the width defaults to 1.

Value

The width of the event's contact area (in CSS pixels).

Examples

This example illustrates using the PointerEvent interface's width and height properties to calculate the contact area.

js
target.addEventListener(
  "pointerdown",
  (ev) => {
    / Calculate the contact area
    const area = ev.width * ev.height;
  },
  false,
);

Specifications

Specification
Product help
  • altitudeAngle
  • persistentDeviceId\nExperimental\n
  • tangentialPressure
  • width
  • Instance methods
    1. UIEvent
    2. Element.setPointerCapture()
    3. Navigator.maxTouchPoints
  • ","source":{"folder":"en-us/web/api/pointerevent/width","github_url":"https://github.com/mdn/content/blob/main/files/en-us/web/api/pointerevent/width/index.md","last_commit_url":"https://github.com/mdn/content/commit/b71d118ffc6d72b77efad9661110fcc9ede464eb","filename":"index.md"},"summary":"The width read-only property of the\nPointerEvent interface represents the width of the pointer's contact\ngeometry along the x-axis, measured in CSS pixels. Depending on the source of the\npointer device (such as a finger), for a given pointer, each event may produce a\ndifferent value.","title":"PointerEvent: width property","toc":[{"text":"Value","id":"value"},{"text":"Examples","id":"examples"},{"text":"Specifications","id":"specifications"},{"text":"Browser compatibility","id":"browser_compatibility"}],"baseline":{"baseline":"high","baseline_low_date":"2020-07-28","baseline_high_date":"2023-01-28","support":{"chrome":"55","chrome_android":"55","edge":"12","firefox":"59","firefox_android":"79","safari":"13","safari_ios":"13"}},"browserCompat":["api.PointerEvent.width"],"pageType":"web-api-instance-property"}}

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant