
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
tailwindcss-pseudo-elements
Advanced tools
TailwindCSS Plugin that adds variants of pseudo elements (::before
, ::after
, ::first-letter
, etc.).
npm install tailwindcss-pseudo-elements --save-dev
yarn add tailwindcss-pseudo-elements -D
const plugin = require('tailwindcss/plugin')
module.exports = {
variants: {
extend: {
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']
)
}),
],
}
<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>
There are utilities that set the attributes of HTML elements to the content property.
Mark it up as follows:
<p
class="text-lg text-blue-600 content-before content-after content-hover-before"
tw-content-before="๐งก"
tw-content-hover-before="๐"
tw-content-after="๐๏ธ"
>
Tailwind CSS
</p>
FAQs
TailwindCSS Plugin that adds variants of pseudo elements.
The npm package tailwindcss-pseudo-elements receives a total of 3,161 weekly downloads. As such, tailwindcss-pseudo-elements popularity was classified as popular.
We found that tailwindcss-pseudo-elements demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.