Socket
Socket
Sign inDemoInstall

css-has-pseudo

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-has-pseudo

Style elements relative to other elements in CSS


Version published
Weekly downloads
5.5M
increased by1.49%
Maintainers
3
Weekly downloads
 
Created

What is css-has-pseudo?

The css-has-pseudo package is a tool designed to polyfill CSS :has() pseudo-class support in environments where it is not natively available. This package enables developers to use the :has() selector in their CSS, allowing for more complex styling scenarios based on the presence of descendants in the DOM.

What are css-has-pseudo's main functionalities?

Polyfill for :has() pseudo-class

This feature allows developers to use the :has() CSS pseudo-class in environments that do not support it natively. The code sample demonstrates how to import the polyfill and apply a CSS rule using :has() to style an unordered list with a blue border if it contains an 'li' element with the class 'active'.

import 'css-has-pseudo';

// Example CSS using :has()
const style = `
  ul:has(> li.active) {
    border: 1px solid blue;
  }
`;

// Apply styles to document
const styleSheet = document.createElement('style');
styleSheet.innerText = style;
document.head.appendChild(styleSheet);

Other packages similar to css-has-pseudo

Keywords

FAQs

Package last updated on 13 May 2024

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