當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


CSS inset-block-end用法及代碼示例

CSS中的inset-block-end屬性用於定義邏輯塊結束偏移,而不用於內聯偏移或邏輯塊。此屬性可以應用於任何writing-mode屬性。

用法:

inset-block-end:length | percentage | auto | inherit | initial | unset;

屬性值:



  • length:它設置以px,cm,pt等為單位的固定值。也可以使用負值。其默認值為0px。
  • percentage:它與長度相同,但是根據窗口大小的百分比設置。
  • auto:當需要瀏覽器確定inset-block-end時使用。
  • initial:它用於將inset-block-end屬性的值設置為其默認值。
  • inherit:當需要該元素從其父元素繼承inset-block-end屬性時使用。
  • unset:它用於取消設置默認的inset-block-end屬性。

以下示例說明了CSS中的inset-block-end屬性:

範例1:

<!DOCTYPE html> 
<html> 
  
<head> 
    <title>CSS | inset-block-end Property</title> 
    <style> 
        h1 { 
            color:green; 
        } 
          
        div { 
            background-color:green; 
            width:200px; 
            height:20px; 
        } 
          
        .one { 
            position:relative; 
            inset-block-end:30px; 
            background-color:cyan; 
        } 
    </style> 
</head> 
  
<body> 
    <center> 
        <h1>Geeksforgeeks</h1> 
        <b>CSS | inset-block-end Property</b> 
        <br><br> 
        <div> 
            <p class="one"> 
                A Computer Science Portal for Geeks 
            </p> 
        </div> 
  
    </center> 
</body> 
  
</html>                    

輸出:

範例2:

<!DOCTYPE html> 
<html> 
  
<head> 
    <title>CSS | inset-block-end Property</title> 
    <style> 
        h1 { 
            color:green; 
        } 
          
        div { 
            background-color:green; 
            width:200px; 
            height:120px; 
        } 
          
        .one { 
            writing-mode:vertical-rl; 
            position:relative; 
            inset-block-end:50px; 
            background-color:cyan; 
        } 
    </style> 
</head> 
  
<body> 
    <center> 
        <h1>Geeksforgeeks</h1> 
        <b>CSS | inset-block-end Property</b> 
        <br><br> 
        <div> 
            <p class="one"> 
                A Computer Science Portal for Geeks 
            </p> 
        </div> 
  
    </center> 
</body> 
  
</html>                    

輸出:

支持的瀏覽器:下麵列出了inset-block-end屬性支持的瀏覽器:

  • Firefox
  • 穀歌瀏覽器
  • Edge
  • Opera

參考: https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block-end




相關用法


注:本文由純淨天空篩選整理自skyridetim大神的英文原創作品 CSS | inset-block-end Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。