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

CSS अपडेट: टेक्स्ट डेकोरेशन और अंडरलाइन स्टाइलिंग के लिए नए प्रॉपर्टीज


परिचय

नए टेक्स्ट-डेकोरेशन प्रॉपर्टीज की शुरुआत के साथ, हम पहले से कहीं अधिक तरीकों से टेक्स्ट को स्टाइल कर सकते हैं। text-decoration अब text-decoration-thickness, text-decoration-color, text-decoration-line, और text-decoration-style के लिए शॉर्टहैंड है। text-decoration-skip, text-decoration-skip-ink, text-underline-offset, और text-underline-position को स्पष्ट रूप से निर्दिष्ट करने की आवश्यकता है।

सिंटैक्स

selector {
  text-decoration: /* value */;
}

उदाहरण 1: बुनियादी टेक्स्ट डेकोरेशन स्टाइल्स

<!DOCTYPE html>
<html>
<head>
  <style>
    #one {
      text-decoration-style: double;
      text-decoration-skip-ink: auto;
    }
    p {
      padding: 2%;
      text-decoration-line: underline overline;
      text-decoration-style: wavy;
    }
    p:nth-of-type(even) {
      text-decoration: overline;
    }
    span {
      text-decoration: line-through;
    }
  </style>
</head>
<body>
  <p id="one">Random Demo abcdefghijklmnopqrstuvwxyz</p>
  <p>Random Demo Text</p>
  <p>Random <span>Demo</span> Text</p>
</body>
</html>

उदाहरण 2: एडवांस्ड अंडरलाइन कस्टमाइजेशन

<!DOCTYPE html>
<html>
<head>
  <style>
    p {
      margin: 3%;
      font-size: x-large;
      text-decoration-line: underline overline;
      text-decoration-style: dotted;
      text-decoration-skip-ink: none;
      text-decoration-thickness: 4px;
    }
  </style>
</head>
<body>
  <p>Super Demo abcdefghijklmnopqrstuvwxyz</p>
</body>
</html>

मुख्य प्रॉपर्टीज समझाया गया

प्रॉपर्टी विवरण मान
text-decoration-line किस प्रकार की डेकोरेशन लाइन प्रदर्शित करनी है underline, overline, line-through, none
text-decoration-style डेकोरेशन लाइन की शैली solid, double, dotted, dashed, wavy
text-decoration-color डेकोरेशन लाइन का रंग कोई भी वैध CSS रंग
text-decoration-thickness डेकोरेशन लाइन की मोटाई auto, from-font, <length>, <percentage>
text-underline-offset अंडरलाइन और टेक्स्ट के बीच की दूरी auto, <length>, <percentage>
text-underline-position अंडरलाइन की स्थिति auto, under, left, right
text-decoration-skip-ink क्या अंडरलाइन ग्लिफ्स को छोड़नी चाहिए auto, none, all

व्यावहारिक उपयोग के मामले

  • हाइपरलिंक स्टाइलिंग: कस्टम अंडरलाइन रंग, ऑफसेट, और होवर प्रभाव
  • टाइपोग्राफी एन्हांसमेंट: पठनीयता के लिए वेवी या डॉटेड अंडरलाइन
  • संपादन मार्कअप: हटाए गए टेक्स्ट के लिए स्ट्राइकथ्रू, सम्मिलन के लिए अंडरलाइन
  • सांस्कृतिक टाइपोग्राफी: text-underline-position: under वंशज ग्लिफ्स (जैसे हिंदी, अरबी) के लिए

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

अधिकांश मॉडर्न ब्राउज़र इन प्रॉपर्टीज को सपोर्ट करते हैं। text-underline-offset और text-decoration-thickness के लिए, IE में सपोर्ट सीमित है लेकिन सभी मॉडर्न ब्राउज़र (Chrome 87+, Firefox 70+, Safari 12.1+, Edge 87+) में काम करता है।

  1. 2020 में वेब डिज़ाइन के लिए नवीनतम CSS प्रॉपर्टीज़ और APIs 2020 में वेब डिज़ाइन के लिए नवीनतम CSS प्रॉपर्टीज़ और APIs

    नई CSS प्रॉपर्टीज़ और APIs डेवलपर्स को JavaScript और CSS के मिश्रण से वेबसाइट कस्टमाइज़ करने में मदद के लिए नई CSS प्रॉपर्टीज़ विकसित की गई हैं जो अब लोकप्रिय ब्राउज़र्स में सपोर्टेड हैं। कुछ नीचे सूचीबद्ध हैं: focus-within एलिमेंट्स के भीतर फोकस-एक्सेसिबिलिटी को हल करने का लक्ष्य। scroll-snap नेटि

  1. CSS text-align और text-justify प्रॉपर्टीज का उपयोग करके टेक्स्ट जस्टिफाई करना CSS text-align और text-justify प्रॉपर्टीज का उपयोग करके टेक्स्ट जस्टिफाई करना

    परिचय CSS text-justify प्रॉपर्टी हमें किसी एलिमेंट के लिए जस्टिफिकेशन प्रकार निर्दिष्ट करने में मदद करती है। text-align प्रॉपर्टी किसी एलिमेंट में टेक्स्ट के क्षैतिज संरेखण को सेट करती है। साथ में, वे परिष्कृत टेक्स्ट लेआउट नियंत्रण प्रदान करते हैं। उदाहरण 1: इंटर-कैरेक्टर जस्टिफिकेशन <!DOCTYPE

  1. फॉर्म इनपुट फील्ड्स के लिए कुछ कम-ज्ञात CSS प्रॉपर्टीज फॉर्म इनपुट फील्ड्स के लिए कुछ कम-ज्ञात CSS प्रॉपर्टीज

    परिचय CSS caret-color, pointer-events, और tab-size फॉर्म इनपुट फील्ड्स के लिए कुछ कम-ज्ञात प्रॉपर्टीज हैं। caret-color हमें ब्लिंकिंग कैरेट का रंग निर्दिष्ट करने की अनुमति देता है, pointer-events उपयोगकर्ताओं को किसी एलिमेंट के साथ इंटरैक्ट करने से रोकने में मदद कर सकता है, और tab-size टैब द्वारा उ