npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tailwindcss-pixel

v1.1.1

Published

Using Tailwind CSS with pixel units

Readme

TailwindCSS Pixel

Introduction

TailwindCSS Pixel is an plugin for Tailwind CSS that allows you to define styles based on pixel (px) values directly in your markup. This plugin bridges the gap between Tailwind's utility-first approach and the need for pixel-specific adjustments. It's especially useful for projects where fine-grained control over layout and design is needed.

Features

  • Pixel-based margin, padding, width, height, etc.
  • Works seamlessly with existing Tailwind CSS utilities.
  • Highly configurable to fit your needs.

Installation

Install the package via npm or yarn or pnpm:

npm install tailwindcss-pixel
# or
yarn add tailwindcss-pixel
# or
pnpm add tailwindcss-pixel

Then, add tailwindcss-pixel to your tailwind.config.js:

// tailwind.config.js

module.exports = {
  // ...
  plugins: [
    require('tailwindcss-pixel')({
        rem: true, // default: false
        // ...
    }),
    // ...
  ],
}
  • rem
    • default: false
    • If set to true, rem-based pixel units will be available.
    • Example: w-10pxwidth: 0.625rem;
  • extends
    • If set to true, the plugin will extend the default Tailwind CSS utilities instead of adding new ones. This is useful if you want to use pixel-based adjustments in your project but don't want to have to use the px suffix for all of them.
  • suffix
    • The suffix to use for the pixel-based utilities. Defaults to px.
  • properties
    • [start: number, end: number, gap: number]
    • spacing, min-width, min-height, max-width, max-height, width, height, fontSize, borderWidth, borderRadius, fontSize, lineHeights, letterSpacing, etc.
    • You can customize the plugin by adding a pixel object inside the theme section of your tailwind.config.js:
    • Example:
      // tailwind.config.js
      
      module.exports = {
        plugins: [
          require('tailwindcss-pixel')({
              rem: true, // default: false
              minWidth: [0, 1024, 2] // this will generate from min-w-0 to min-w-1024 with 2px gap
          }),
          // ...
        ],
      }

Usage

After installation and configuration, pixel-specific utility classes become available in your HTML markup:

<!-- width -->
<div class="w-200px">Width 200px</div>

<!-- height -->
<div class="h-100px">Height 100px</div>

<!-- margin and padding -->
<div class="m-10px p-20px">Margin and padding</div>

<!-- font size -->
<div class="text-20px">Font size 20px</div>

<!-- border width -->
<div class="border-1px">Border width 1px</div>

<!-- border radius -->
<div class="rounded-10px">Border radius 10px</div>

<!-- etc -->

Configuration

You can customize the plugin by adding a pixel object inside the theme section of your tailwind.config.js:

// tailwind.config.js

module.exports = {
  theme: {
    // ...
    pixel: {
      spacing: {
        '10': '10px',
        '20': '20px',
        '30': '30px',
        // ...
      },
      //...
    },
  },
  plugins: [
    require('tailwindcss-pixel-plugin'),
  ],
}

License

MIT

For more information, see LICENSE.