font-variant गुण का उपयोग font-variant-caps, font-variant-numeric, font-variant-alternates, font-variant-ligatures, और font-variant-east-asian निर्दिष्ट करने के लिए किया जाता है।
सिंटैक्स
फॉन्ट-वेरिएंट प्रॉपर्टी का सिंटैक्स इस प्रकार है -
Selector {
font-variant: /*value*/
} निम्नलिखित उदाहरण CSS के फॉन्ट-वेरिएंट गुण को दर्शाते हैं -
उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
table * {
box-shadow: inset 0 0 10px lavender;
font-size: 1.2em;
font-variant: small-caps;
}
td + td {
font-variant: all-petite-caps;
}
</style>
</head>
<body>
<table>
<tr>
<th>DEMO a</th>
<th>DEMO b</th>
</tr>
<tr>
<td>1a</td>
<td>1b</td>
</tr>
<tr>
<td>2a</td>
<td>2b</td>
</tr>
</table>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है -

उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
div {
display: flex;
margin: 20px;
width: 20%;
float: left;
box-shadow: inset 0 0 9px orange;
}
#demo {
font-variant: unicase;
}
</style>
</head>
<body>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pellentesque felis ac lorem ornare maximus.</div>
<div id="demo">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pellentesque felis ac lorem ornare maximus.</div>
</body>
</html> आउटपुट
यह निम्न आउटपुट देता है -
