Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS font-variant प्रॉपर्टी


font-variant प्रॉपर्टी

CSS में font-variant प्रॉपर्टी निम्नलिखित प्रॉपर्टीज का शॉर्टहैंड है:

  • font-variant-caps
  • font-variant-numeric
  • font-variant-alternates
  • font-variant-ligatures
  • font-variant-east-asian

बुनियादी मान (CSS1/2):

font-variant: normal | small-caps | initial | inherit;

मान:

  • normal: डिफ़ॉल्ट, कोई वेरिएंट नहीं
  • small-caps: लोअरकेस अक्षरों को छोटे बड़े अक्षरों (स्मॉल कैप्स) में बदलता है

उदाहरण 1: normal मान

<!DOCTYPE html>
<html>
<head>
<style>
body {
  background-image: linear-gradient(to right, yellow, orange, yellow, green, blue, indigo, violet);
}
.demo {
  text-decoration: overline;
  text-decoration-color: yellow;
  font-variant: normal;
}
</style>
</head>
<body>
<h1>परीक्षा विवरण</h1>
<p class="demo">परीक्षा 20 दिसंबर को।</p>
<p class="demo2">परीक्षा सुबह 9 बजे शुरू होती है।</p>
</body>
</html>

आउटपुट

सामान्य टेक्स्ट रेंडरिंग, इंद्रधनुषी ग्रेडिएंट बैकग्राउंड के साथ।

उदाहरण 2: small-caps मान

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
  text-decoration: overline underline;
  text-decoration-color: blue;
  font-variant: small-caps;
}
</style>
</head>
<body>
<h1>विवरण</h1>
<p class="demo">परीक्षा केंद्र ABC कॉलेज के पास।</p>
<p class="demo2">परीक्षा सुबह 9 बजे शुरू होती है।</p>
</body>
</html>

आउटपुट

सभी लोअरकेस अक्षर छोटे बड़े अक्षरों (स्मॉल कैप्स) में दिखाई देंगे, नीली ओवरलाइन और अंडरलाइन के साथ।

मॉडर्न font-variant सब-प्रॉपर्टीज (CSS3):

सब-प्रॉपर्टीउद्देश्यउदाहरण मान
font-variant-capsकैपिटलाइज़ेशन वेरिएंट्सsmall-caps, all-small-caps, petite-caps, unicase, titling-caps
font-variant-numericसंख्यात्मक फॉर्मेटिंगlining-nums, oldstyle-nums, proportional-nums, tabular-nums, diagonal-fractions, stacked-fractions, ordinal, slashed-zero
font-variant-ligaturesलिगेचर कंट्रोलcommon-ligatures, discretionary-ligatures, historical-ligatures, contextual
font-variant-east-asianपूर्वी एशियाई टाइपोग्राफीjis78, jis83, jis90, jis04, simplified, traditional, full-width, proportional-width, ruby
font-variant-alternatesवैकल्पिक ग्लिफ्सhistorical-forms, styleset(), character-variant(), swash(), ornaments(), annotation()

उदाहरण: मॉडर्न सिंटैक्स

.advanced-typography {
  font-variant-caps: small-caps;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-variant-ligatures: common-ligatures contextual;
}

ब्राउज़र सपोर्ट:

  • small-caps: सभी ब्राउज़र्स
  • सब-प्रॉपर्टीज: आधुनिक ब्राउज़र्स (कुछ आंशिक सपोर्ट)
  • फॉन्ट में संबंधित ग्लिफ्स होने चाहिए
  1. - CSS font-size-adjust प्रॉपर्टी

    font-size-adjust प्रॉपर्टी का उपयोग फ़ॉन्ट फॉलबैक होने पर पठनीयता बनाए रखने के लिए किया जाता है। यह पहलू मूल्य (एस्पेक्ट वैल्यू) को निर्दिष्ट करता है जो पहले पसंद के फ़ॉन्ट के लोअरकेस x की ऊंचाई के अनुपात को फ़ॉन्ट आकार के सापेक्ष दर्शाता है। उदाहरण <!DOCTYPE html> <html> <head>

  1. - CSS white-space प्रॉपर्टी

    white-space प्रॉपर्टी का उपयोग किसी तत्व के अंदर व्हाइट स्पेस (स्पेस, टैब, लाइन ब्रेक) को कैसे संभाला जाए, इसे नियंत्रित करने के लिए किया जाता है। उदाहरण <!DOCTYPE html> <html> <head> <style> p.demo1 { white-space: normal; } p.demo2 {

  1. CSS में writing-mode प्रॉपर्टी CSS में writing-mode प्रॉपर्टी

    writing-mode प्रॉपर्टी का उपयोग यह सेट करने के लिए किया जाता है कि टेक्स्ट की लाइनें क्षैतिज या लंबवत रूप से रखी गई हैं। प्रॉपर्टी मान writing-mode: horizontal-tb | vertical-rl | vertical-lr; उदाहरण <!DOCTYPE html> <html> <head> <style> p { writing-mode: vertic