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


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

inset-inline-end屬性是CSS中的內置屬性。它用於定義邏輯內聯末端偏移,而不是用於塊偏移或邏輯塊。此屬性可以應用於任何writing-mode屬性。

用法:

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

屬性值:



  • length:它設置一個以px,cm,pt等為單位的固定值。允許使用負值。其默認值為0px。
  • percentage:它根據窗口大小的百分比設置長度。
  • auto:當需要瀏覽器確定inset-inline-end時使用。
  • initial:它用於將inset-inline-end屬性的值設置為其默認值。
  • inherit:當希望該元素繼承其父元素的inset-inline-end屬性時,可以使用它。
  • unset:在未設置默認inset-inline-end的情況下使用它。

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

範例1:

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

輸出:

支持的瀏覽器:inset-inline-end屬性支持的瀏覽器如下所示:

  • Firefox
  • Edge
  • Opera



相關用法


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