CSS 逻辑属性与值

CSS 逻辑属性与值CSS 的一个模块,其引入的属性与值能做从逻辑角度控制布局,而不是从物理、方向或维度来控制。

The module also defines logical properties and values for properties previously defined in CSS 2.1. Logical properties define direction‐relative equivalents of their corresponding physical properties.

block 与 inline

Logical properties and values use the abstract terms block and inline to describe the direction in which they flow. The physical meaning of these terms depends on the writing mode.

Block dimension
The dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes. For standard English text, it is the vertical dimension.
Inline dimension
The dimension parallel to the flow of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes. For standard English text, it is the horizontal dimension.

参考

大小属性

外边距 、边框与内边距属性

浮动与定位属性

其他属性

已弃用属性

指南

规范

规范 状态 备注
CSS Logical Properties and Values Level 1 Editor's Draft Initial definition.

浏览器兼容熊

In general:

  • Firefox has support for the mapped properties — where there is a direct mapping from the physical to the logical version.
  • Chrome, from version 69, has support for the mapped properties.
  • Edge, from version 79, has the same support as Chrome.
  • Firefox 66 introduces support for two value shorthands, also behind a flag in Chrome.
  • Internet Explorer has no support.

See the individual property pages for full compatibility information.