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


CSS font-variant-ligatures屬性用法及代碼示例

CSS font-variant-ligatures屬性用於控製文本字體的連字。連字是將兩個或多個字符組合為一個特殊字符。連字通常用於賦予文本某些樣式或外觀。

用法:

font-variant-ligatures:Keyword_values

或者

 font-variant-ligatures:Global_values 

屬性值:該屬性接受上麵提到的和下麵描述的屬性值。

  • Keyword_values:該屬性值是指由“normal”,“none”,“common-ligatures”,“no-common-ligatures”,“discretionary-ligatures”,“no-discretionary-ligatures”,“historical-ligatures”,“no-historical-ligatures”,“contextual”,“no-contextual”定義的值。
  • Global_values:該屬性值是指由“inherit”,“initial”,“unset”定義的值。

範例1:下麵的示例說明了使用common-ligatures和no-common-ligatures的font-variant-ligatures屬性的使用。



HTML

<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <style> 
        div { 
            font-size:5vw; 
        } 
  
        .off { 
            font-variant-ligatures:no-common-ligatures; 
            color:rgb(83, 241, 21); 
        } 
  
        .on { 
            font-variant-ligatures:common-ligatures; 
            color:rgb(96, 153, 4); 
        } 
    </style> 
</head> 
  
<body> 
    <h1 style="color:green;">GeeksforGeeks</h1> 
    <div> 
        <span class="off">wifi</span> 
        <span class="on">wifi</span> 
    </div> 
</body> 
  
</html>

輸出:

支持的瀏覽器:

  • Chrome
  • Firefox
  • Safari
  • Opera
  • Edge
  • Internet Explorer(不支持)。

相關用法


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