CSS Portal

CSS touch-action Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The touch-action property tells the user agent which built-in touch and pointer behaviors (for example, panning, scrolling, or pinch-zooming) are permitted on an element. By declaring which default gestures the browser may perform, it changes how the platform interprets sequences of pointer/touch input before and while your page’s scripts run. In practice this means authors can express intent about whether the browser should immediately handle gestures or allow scripts to intercept them, which affects how and when pointer or touch events are dispatched to your handlers.

Because it influences whether the browser will perform native gesture handling, touch-action has a direct impact on event timing and the need for JavaScript to call preventDefault() on touch/pointer events. When the browser knows a gesture is allowed, it can handle it natively without waiting to see if script will cancel it, which reduces input latency and avoids interaction delays that otherwise occur while waiting for script responses. This can significantly improve responsiveness on touch devices and reduce the need for heavy event-marker code. By contrast, properties such as pointer-events control whether an element receives pointer events at all, but do not instruct the browser about gesture handling or scrolling behavior.

The property also matters in documents with nested scrollable regions, transformed content, or complex gesture interactions: it helps the browser decide which layer should handle a pan, whether a child element’s gesture should take precedence over a parent’s scrolling behavior, and how touches are apportioned across the element tree. That interaction is complementary to scroll-related CSS like overscroll-behavior, which governs what happens at scroll boundaries; together they let authors shape both how gestures are recognized and what happens when scrolling reaches an edge.

From a design and accessibility perspective, use of touch-action should be intentional: set it where you need to guarantee direct, low-latency gesture handling (for example on custom drag or drawing surfaces), and avoid broadly disabling platform gestures on elements that users expect to scroll or zoom. It is often paired with other affordance-related properties such as user-select (which controls text selection) and with pointer-event handling in script. When authoring, prefer applying the property at the smallest element scope required (container vs. individual children) so you preserve native interactions elsewhere and keep touch responsiveness predictable.

Definition

Initial value
auto
Applies to
all elements except: non-replaced inline elements, table rows, row groups, table columns, and column groups
Inherited
no
Computed value
as specified
Animatable
no
JavaScript syntax
object.style.touchAction

Interactive Demo

Syntax

touch-action: auto | none | pan-x | pan-y | pinch-zoom | manipulation 

Values

  • autoAllows the browser to handle all pan and zoom interactions. This is the default value.
  • noneDisables the browser from handling all pan and zoom interactions. This can be useful for custom interactive UI elements.
  • pan-xEnables horizontal panning with a single finger interaction.
  • pan-yEnables vertical panning with a single finger interaction.
  • pinch-zoomEnables pinch-to-zoom gestures.
  • manipulationAllows the browser to handle all pan, zoom, and other touch gestures.

Example

<div class='wrap'>
<p class='note'>Try this on a touch device or with browser touch emulation.</p>

<div class='row'>
<div class='box none' tabindex='0'>
touch-action: none
<br>
(prevents scrolling/pinch)
</div>

<div class='box pan-x' tabindex='0'>
touch-action: pan-x
<br>
(allows horizontal panning)
</div>

<div class='box pan-y' tabindex='0'>
touch-action: pan-y
<br>
(allows vertical panning)
</div>
</div>
</div>
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 24px;
    background: #f7f8fb;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
}

.note {
    margin: 0 0 12px 0;
    color: #334155;
}

.row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.box {
    flex: 1 1 260px;
    min-height: 140px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    color: #ffffff;
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
}

.box.none {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    touch-action: none;
}

.box.pan-x {
    background: linear-gradient(135deg, #4dabf7 0%, #74c0fc 100%);
    touch-action: pan-x;
}

.box.pan-y {
    background: linear-gradient(135deg, #63e6be 0%, #38d9a9 100%);
    touch-action: pan-y;
}

/* Make the boxes visually responsive on small screens */
@media (max-width: 640px) {
    .row {
        flex-direction: column;
    }

    .box {
        flex: 1 1 auto;
    }
}

Browser Support

The following information will show you the current browser support for the CSS touch-action property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!