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


SVG font-weight屬性用法及代碼示例

這個font-weight“屬性”是指相對於同一字體係列中的其他字體,用於呈現文本的字形的粗體或明暗度。

用法:

font-variant="variation"

屬性值:

  • Default value:默認值是正常的。
  • other value:其他值包括粗體,粗體,淺色。

我們將使用font-weight屬性設置字體的粗細。

範例1:



HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <svg viewBox="0 0 200 300" 
        xmlns="http://www.w3.org/2000/svg"> 
          
        <text x="5" y="20" 
            font-weight="Normal"> 
            Normal text 
        </text> 
    </svg> 
</body> 
  
</html>

輸出:

範例2:

HTML

<!DOCTYPE html> 
<html> 
  
<body> 
    <svg viewBox="0 0 200 300" 
        xmlns="http://www.w3.org/2000/svg"> 
          
        <text x="5" y="20" font-weight="bold"> 
            bold text 
        </text> 
    </svg> 
</body> 
  
</html>

輸出:




相關用法


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