寸法の論理的プロパティ

この記事は翻訳作業中です。

このガイドでは、ページ上の要素の大きさの設定に使用する、物理的な方向のプロパティと論理的なプロパティのフローに関連した対応付けを説明します。

When specifying the size of an item, the Logical Properties and Values specification gives you the ability to indicate sizing as it relates to the flow of text (inline and block) rather than physical sizing which relates to the physical dimensions of horizontal and vertical (e.g. left and right). While these flow relative mappings may well become the default for many of us, in a design you may well use both physical and logical sizing. You might want some features to always relate to the physical dimensions whatever the writing mode.

方向への対応付け

The table below provides mappings between logical and physical properties. These mappings assume that you are in a horizontal-tb writing mode, such as English or Arabic, in which case width would be mapped to inline-size.

If you were in a vertical writing mode then inline-size would be mapped to height.

論理的プロパティ 物理的プロパティ
inline-size width
block-size height
min-inline-size min-width
min-block-size min-height
max-inline-size max-width
max-block-size max-height

幅と高さの例

The logical mappings for width and height are inline-size, which sets the length in the inline dimension and block-size, which sets the length in the block dimension. When working in English, replacing width with inline-size and height with block-size will give the same layout.

In the live example below I have set the Writing Mode to horizontal-tb. Change it to vertical-rl and you will see that the first example — which uses width and height — remains the same size in each dimension, despite the text becoming vertical. The second example — which uses inline-size and block-size — will follow the text direction as if the entire block has rotated.

最小幅と最小高さの例

There are also mappings for min-width and min-height — these are min-inline-size and min-block-size. These work in the same way as the inline-size and block-size properties, but setting a minimum rather than a fixed size.

Try changing the example below to vertical-rl, as with the first example, to see the effect it has. I am using min-height in the first example and min-block-size in the second.

最大幅と最大高さの例

Finally you can use max-inline-size and max-block-size as logical replacements for max-width and max-height. Try playing with the below example in the same way as before.

サイズ変更の論理キーワード

The resize property sets whether or not an item can be resized and has physical values of horizontal and vertical. The resize property also has logical keyword values. Using resize: inline allows resizing in the inline dimension and resize: block allow resizing in the block dimension.

The keyword value of both for the resize property works whether you are thinking physically or logically. It sets both dimensions at once. Try playing with the below example.

なお、現在のところサイズ変更の論理的プロパティは Firefox のみが対応しています。

ドキュメントのタグと貢献者

このページの貢献者: mdnwebdocs-bot, mfuji09
最終更新者: mdnwebdocs-bot,