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

postcss-pseudo-class-any-link

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-pseudo-class-any-link

Use the proposed :any-link pseudo-class in CSS

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5M
increased by0.94%
Maintainers
1
Weekly downloads
 
Created
Source

PostCSS Pseudo-Class Any-Link is a PostCSS plugin that allows you to use the proposed :any-link pseudo-class in CSS.

:any-link simplifies selectors targeting links, as the naming of :link is misleading; it specifically means unvisited links only, rather than all links.

/* before */

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

/* after */

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

From the proposal:

The :any-link pseudo-class represents an element that acts as the source anchor of a hyperlink. It matches an element if the element would match :link or :visited.

Usage

You just need to follow these two steps to use PostCSS Pseudo-Class Any-Link:

  1. Add PostCSS to your build tool.
  2. Add PostCSS Pseudo-Class Any-Link as a PostCSS process.
npm install postcss-pseudo-class-any-link --save-dev

Node

postcss([ require('postcss-pseudo-class-any-link')({ /* options */ }) ])

Grunt

Add Grunt PostCSS to your build tool:

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

Enable PostCSS Pseudo-Class Any-Link within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
	postcss: {
		options: {
			processors: [
				require('postcss-pseudo-class-any-link')({ /* options */ })
			]
		},
		dist: {
			src: 'css/*.css'
		}
	}
});

Options

prefix (string): prepends a prefix (surrounded by dashes) to the pseudo-class, preventing any clash with native syntax.

{
	prefix: 'foo' // pseudo-class becomes :-foo-any-link
}

Alternatives

Here are a few other ways to simulate the effect of PostCSS Pseudo-Class Any-Link.

/* Use @custom-selector; supported nowhere yet */

@custom-selector :--any-link :link, :visited;

:--any-link { /* ... */ }

/* Use :matches; supported in Firefox 4+, Chrome 12+, Opera 15+, Safari 5.1+ */

:matches(:link, :visited) { /* ... */ }

/* Use :link and :visited; supported everywhere */

:link, :visited { /* ... */ }

Keywords

FAQs

Package last updated on 31 Aug 2015

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