Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwindcss-pseudo-elements

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwindcss-pseudo-elements

TailwindCSS Plugin that adds variants of pseudo elements.

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
increased by16.14%
Maintainers
2
Weekly downloads
 
Created
Source

tailwindcss-pseudo-elements

TailwindCSS Plugin that adds variants of pseudo elements (::before, ::after, ::first-letter, etc.).

Usage

Install

NPM
npm install tailwindcss-pseudo-elements --save-dev
Yarn
yarn add tailwindcss-pseudo-elements -D

Configuration

const plugin = require('tailwindcss/plugin')

module.exports = {
  variants: {
    textColor: [
      'responsive',
      'hover',
      'focus',
      'before',
      'after',
      // If you want to combine it with a pseudo class,
      // use `<pseudo-class>_<pseudo-element>`.
      'hover_before',
      'hover_after',
      'focus_before',
      'foo_bar',
    ],
  },

  // You can set up your own pseudo-classes and pseudo-elements.
  customPseudoClasses: ['foo'],
  customPseudoElements: ['bar'],

  plugins: [
    require('tailwindcss-pseudo-elements'),
    // This plugin is useful in combination with tailwindcss-aspect-ratio.
    require('tailwindcss-aspect-ratio')({
      ratios: {
        '16/9': [16, 9],
        '4/3': [4, 3],
        '3/2': [3, 2],
        '1/1': [1, 1],
      },
      variants: ['before', 'hover_before', 'responsive'],
    }),
    plugin(function ({ addUtilities }) {
      addUtilities(
        {
          '.empty-content': {
            content: "''",
          },
        },
        ['before']
      )
    }),
  ],
}

HTML

<div
  class="relative
    before:aspect-ratio-4/3
    hover:before:aspect-ratio-1/1
    before:empty-content"
>
  <img class="absolute pin w-full h-full" src="..." />
</div>

Keywords

FAQs

Package last updated on 25 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc