互動

觸控操作touch-action

Setting how an element's region can be manipulated by a touchscreen user.

Overview

ClassDeclarations
touch-action:autotouch-action: auto;
touch-action:nonetouch-action: none;
touch-action:pan-xtouch-action: pan-x;
touch-action:pan-lefttouch-action: pan-left;
touch-action:pan-righttouch-action: pan-right;
touch-action:pan-ytouch-action: pan-y;
touch-action:pan-uptouch-action: pan-up;
touch-action:pan-downtouch-action: pan-down;
touch-action:pinch-zoomtouch-action: pinch-zoom;
touch-action:manipulationtouch-action: manipulation;
touch-action:<value>touch-action: <value>;

Examples

Disable browser gestures on a custom surface

Use touch-action:none for canvases or drag surfaces that handle their own touch gestures.

<canvas class="touch-action:none">    Drawing surface</canvas>
Generated CSS
@layer utilities {    .touch-action\:none {        touch-action: none    }}

Allow vertical scrolling

Use touch-action:pan-y for horizontal carousels so the page can still scroll vertically.

<div class="overflow-x:auto touch-action:pan-y">    Carousel</div>

Optimize tap controls

Use touch-action:manipulation on buttons and links when the element only needs tap and click behavior.

<button class="touch-action:manipulation">    Submit</button>

Apply conditionally

Apply styles based on different states using selectors and conditional queries.

<div class="touch-action:none:hover touch-action:pan-y@sm touch-action:auto@print">...</div>

  • Master UI


© 2026 Aoyue Design LLC.MIT License
Trademark Policy