font-variant屬性用於將所有小寫字母轉換為大寫字母。但是轉換後的大寫字母看起來比原始大寫字母小font-size。
用法:
font-variant:normal|small-caps|initial;
屬性值:
- normal:它具有默認值。它指定一個普通的font-size。
用法:
font-variant:normal;
例:
<!DOCTYPE html> <html> <head> <style> h1 { color:green; } p.geeks { font-variant:normal; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>font-variant:normal;</h2> <p class="geeks">GeeksForGeeks.</p> <p>It is a computer science portal for geeks.</p> </body> </html>
輸出:
- small-caps:用於將所有小寫字母轉換為大寫字母。
用法:
font-variant:small-caps;
例:
<!DOCTYPE html> <html> <head> <style> h1 { color:green; } p.geeks { font-variant:small-caps; } .gfg { font-variant:small-caps; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>font-variant:small-caps;</h2> <p class="geeks">GeeksForGeeks.</p> <p class="gfg"> It is a computer science portal for geeks. </p> </body> </html>
輸出:
- initial:它將屬性設置為其默認值。
用法:
font-variant:initial;
例:
<!DOCTYPE html> <html> <head> <style> h1 { color:green; } p.geeks { font-variant:initial; } .gfg { font-variant:initial; } </style> </head> <body> <center> <h1>GeeksForGeeks</h1> <h2>font-variant:initial;</h2> <p class="geeks">GeeksForGeeks.</p> <p class="gfg"> It is a computer science portal for geeks. </p> </body> </html>
輸出:
支持的瀏覽器:CSS font-variant屬性支持的瀏覽器如下:
- 穀歌瀏覽器1.0
- Internet Explorer 4.0
- Firefox 1.0
- Opera 3.5
- 蘋果Safari 1.0
相關用法
- HTML Style fontVariant用法及代碼示例
- CSS transition-property用法及代碼示例
- CSS table-layout用法及代碼示例
- CSS text-align用法及代碼示例
- CSS border-top-width用法及代碼示例
- CSS isolation屬性用法及代碼示例
- CSS border-inline-start-style屬性用法及代碼示例
- CSS column-rule-width用法及代碼示例
- CSS word-spacing用法及代碼示例
- CSS animation-delay用法及代碼示例
- CSS margin-top用法及代碼示例
- CSS grid屬性用法及代碼示例
- CSS font-size-adjust用法及代碼示例
- CSS visibility屬性用法及代碼示例
- CSS grid-template-columns用法及代碼示例
- CSS height屬性用法及代碼示例
- CSS transform-origin用法及代碼示例
- CSS animation-name用法及代碼示例
- CSS flex-wrap用法及代碼示例
- CSS align-content用法及代碼示例
- CSS page-break-before屬性用法及代碼示例
注:本文由純淨天空篩選整理自ManasChhabra2大神的英文原創作品 CSS font-variant Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。