postcss-pseudo-class-any-link

Use the :any-link pseudo-class in CSS

MIT-0 29 个版本
安装
npm install postcss-pseudo-class-any-link
yarn add postcss-pseudo-class-any-link
pnpm add postcss-pseudo-class-any-link
bun add postcss-pseudo-class-any-link
README

PostCSS Pseudo Class Any Link PostCSS Logo

npm install postcss-pseudo-class-any-link --save-dev

PostCSS Pseudo Class Any Link lets you :any-link pseudo-class in CSS, following the Selectors specification.

nav :any-link > span {
	background-color: yellow;
}

/* becomes */

nav :link > span, nav :visited > span {
	background-color: yellow;
}
nav :any-link > span {
	background-color: yellow;
}

Usage

Add PostCSS Pseudo Class Any Link to your project:

npm install postcss postcss-pseudo-class-any-link --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssPseudoClassAnyLink = require('postcss-pseudo-class-any-link');

postcss([
	postcssPseudoClassAnyLink(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

Options

preserve

The preserve option determines whether the original notation is preserved. By default, it is preserved.

postcssPseudoClassAnyLink({ preserve: false })
nav :any-link > span {
	background-color: yellow;
}

/* becomes */

nav :link > span, nav :visited > span {
	background-color: yellow;
}

subFeatures

areaHrefNeedsFixing

The subFeatures.areaHrefNeedsFixing option determines if <area href> elements should match :any-link pseudo-class.
In IE and Edge these do not match :link or :visited.

This increased CSS bundle size and is disabled by default.

postcssPseudoClassAnyLink({
	subFeatures: {
		areaHrefNeedsFixing: true
	}
})
nav :any-link > span {
	background-color: yellow;
}

/* becomes */

nav :link > span, nav :visited > span, nav area[href] > span {
	background-color: yellow;
}
nav :any-link > span {
	background-color: yellow;
}
版本列表
11.0.0 2026-01-14
10.0.1 2024-10-23
10.0.0 2024-08-03
9.0.2 2024-04-21
9.0.1 2023-12-15
9.0.0 2023-07-03
8.0.2 2023-02-09
8.0.1 2023-01-28
8.0.0 2023-01-24
7.1.6 2022-07-08
7.1.5 2022-06-23
7.1.4 2022-05-17
7.1.3 2022-05-06
7.1.2 2022-04-04
7.1.1 2022-02-05
7.1.0 2022-01-31
7.0.2 2022-01-02
7.0.1 2021-12-13
7.0.0 2021-09-17
6.0.0 2018-09-18
5.0.0 2018-05-08
4.0.0 2017-05-10
3.0.1 2016-12-14
3.0.0 2016-12-06
1.0.0 2015-08-31
0.3.0 2015-06-16
0.2.1 2015-06-16
0.2.0 2015-06-15
0.1.0 2015-06-15