--- title: Interaction Media Queries --- {% include_relative includes/_header.html %}

Description

Generates a series Tailwind media query classes to query a document based on the presence and accuracy of the user’s pointing device and whether it has the ability to hover over elements. For a better understanding, CSS Tricks has a great article about them: Touch Devices Should Not Be Judged By Their Size.

Setup

tailwind.config.js
const { InteractionMediaQueries } = require('@area17/a17-tailwind-plugins');

module.exports = {
  ...
  plugins: [InteractionMediaQueries],
  ...
};

Output

This plugin will output prefix classes which generate media queries for:

Demo

The following, totally pointless example, will have a dark blue background colour on devices where the primary pointer device is a mouse or stylus and a light blue background colour on devices where the primary pointer device is something, such as a finger.

document.html
<div class="bg-column hover-hover:bg-column-alt">...</div>
{% include_relative includes/_footer.html %}