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

postcss-logical

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-logical

Use logical properties and values in CSS

8.1.0
latest
Version published
Weekly downloads
6.3M
7.13%
Maintainers
0
Weekly downloads
 
Created

What is postcss-logical?

The postcss-logical npm package is a PostCSS plugin that allows developers to use logical, rather than physical, property mappings in their CSS. This is particularly useful for writing styles that adapt to different writing modes, such as left-to-right (LTR) and right-to-left (RTL) languages. It transforms logical properties and values into their equivalent directional syntax.

What are postcss-logical's main functionalities?

Logical Properties Conversion

Converts logical properties like 'margin-inline-start' to 'margin-left' or 'margin-right' depending on the direction of the text. This is useful for supporting both LTR and RTL layouts with the same CSS.

/* Input CSS */
:root {
  margin-inline-start: 10px;
}

/* Output CSS */
:root {
  margin-left: 10px; /* in LTR */
  margin-right: 10px; /* in RTL */
}

Logical Values Conversion

Handles logical values such as 'border-inline' which are transformed into 'border-left' or 'border-right'. This feature simplifies the development of cross-directional styles.

/* Input CSS */
:root {
  border-inline: 1px solid black;
}

/* Output CSS */
:root {
  border-left: 1px solid black; /* in LTR */
  border-right: 1px solid black; /* in RTL */
}

Other packages similar to postcss-logical

FAQs

Package last updated on 23 Feb 2025

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