Socket
Socket
Sign inDemoInstall

postcss-dir-pseudo-class

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-dir-pseudo-class

Use the :dir pseudo-class in CSS


Version published
Weekly downloads
5.4M
decreased by-2.48%
Maintainers
3
Weekly downloads
 
Created

What is postcss-dir-pseudo-class?

The postcss-dir-pseudo-class package is a PostCSS plugin that allows you to use the :dir pseudo-class in CSS, enabling styling based on the directionality of text (e.g., left-to-right or right-to-left). This is particularly useful for creating styles that need to adapt to different language directionality, such as supporting both English (LTR) and Arabic or Hebrew (RTL) without having to write separate CSS rules for each.

What are postcss-dir-pseudo-class's main functionalities?

Directional Styling

Allows styling elements differently based on the text direction. This is useful for creating layouts and designs that adapt to both LTR and RTL languages.

/* Input CSS */
:dir(ltr) .selector { float: left; }
:dir(rtl) .selector { float: right; }

/* Output CSS */
.selector:dir(ltr) { float: left; }
.selector:dir(rtl) { float: right; }

Fallback Support

Generates fallbacks for browsers that do not support the :dir pseudo-class, using the [dir] attribute selector instead. This ensures compatibility across a wider range of browsers.

/* Input CSS */
:dir(ltr) .selector { float: left; }
:dir(rtl) .selector { float: right; }

/* Output CSS with fallback */
[dir='ltr'] .selector { float: left; }
[dir='rtl'] .selector { float: right; }

Other packages similar to postcss-dir-pseudo-class

Keywords

FAQs

Package last updated on 15 Dec 2023

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