inset-block-start
        
        
          
                Baseline
                
                  Widely available
                
                 *
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年4月.
* Some parts of this feature may have varying levels of support.
inset-block-start は CSS のプロパティで、要素の論理的なブロック方向の先頭のオフセットを定義し、要素の書字方向やテキストの向きに従って物理的な内部位置に対応付けられます。 top, right, bottom, left のいずれかのプロパティに、 writing-mode, direction, text-orientation で定義された値に従って対応します。
このインセットプロパティは、位置指定されていない要素には効果がありません。
試してみましょう
writing-mode: horizontal-tb;
writing-mode: vertical-rl;
writing-mode: horizontal-tb;
direction: rtl;
writing-mode: vertical-lr;
<section id="default-example">
  <div class="example-container" id="example-element">
    <div id="abspos">
      これは inset-block-start: 50px で絶対位置指定されています。
    </div>
    <p>
      まるで地球の表面から水が引き始めたかのように、通りは泥だらけで、ホルボーン通りを象のようなトカゲのようによちよち歩く、体長 12 メートルほどのメガロサウルスに出会っても不思議ではないでしょう。
    </p>
  </div>
</section>
#example-element {
  border: 0.75em solid;
  padding: 0.75em;
  position: relative;
  width: 100%;
  min-height: 200px;
  unicode-bidi: bidi-override;
}
#abspos {
  background-color: yellow;
  color: black;
  border: 3px solid red;
  position: absolute;
  inset-block-start: 50px;
  inline-size: 140px;
}
構文
css
/* <length> 値 */
inset-block-start: 3px;
inset-block-start: 2.4em;
inset-block-start: anchor(end);
inset-block-start: calc(anchor-size(--myAnchor height, 70px) * 2);
/* 包含ブロックの幅または高さに対する <percentage> 値 */
inset-block-start: 10%;
/* キーワード値 */
inset-block-start: auto;
/* グローバル値 */
inset-block-start: inherit;
inset-block-start: initial;
inset-block-start: revert;
inset-block-start: revert-layer;
inset-block-start: unset;
値
inset-block-start プロパティは left プロパティと同じ値を取ります。
公式定義
| 初期値 | auto | 
|---|---|
| 適用対象 | 位置指定要素 | 
| 継承 | なし | 
| パーセント値 | 包含ブロックの論理的な高さ | 
| 計算値 | 方向が論理的である以外はボックスのオフセット、 top,right,bottom,leftと同じ | 
| アニメーションの種類 | データ型の値は、実数すなわち浮動小数点数として補間されます。">length または の値は、実数の浮動小数点数として補間されます。">パーセント値, calc(); | 
形式文法
inset-block-start =
auto |
<length-percentage>
<length-percentage> =
<length> |
<percentage>
例
>ブロック方向の先頭のオフセットの設定
HTML
html
<div>
  <p class="exampleText">テキストの例</p>
</div>
CSS
css
div {
  background-color: yellow;
  width: 120px;
  height: 120px;
}
.exampleText {
  writing-mode: vertical-lr;
  position: relative;
  inset-block-start: 20px;
  background-color: #c8c800;
}
結果
仕様書
| Specification | 
|---|
| CSS Logical Properties and Values Level 1> # propdef-inset-block-start> | 
| CSS Positioned Layout Module Level 3> # propdef-inset-block-start> | 
ブラウザーの互換性
Loading…
関連情報
- 内部位置を定義する他のプロパティ: inset-block-end,inset-inline-start,inset-inline-end
- 対応する物理的プロパティ: top,right,bottom,left
- writing-mode,- direction,- text-orientation