🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

postcss-dir-pseudo-class

Package Overview
Dependencies
Maintainers
3
Versions
20
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

9.0.1
latest
Source
npm
Version published
Weekly downloads
6.7M
-15.52%
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

attribute

FAQs

Package last updated on 23 Oct 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