HTML डिप्रिकेटेड टैग्स
In this page:
ये टैग्स डिप्रिकेट क्यों किए गए
शुरुआती HTML में content structure और visual presentation एक ही tags में मिले-जुले होते थे, यानी किसी page की styling सीधे उसके markup में ही बेक हो जाती थी।
जैसे-जैसे CSS एक पूर्ण, dedicated styling language के रूप में विकसित हुई, HTML ने ज़्यादातर presentational tags को deprecate कर दिया ताकि structure (HTML) और style (CSS) को साफ-साफ अलग रखा जा सके -- यह सिद्धांत sites को maintain और restyle करना आसान बनाता है।
उदाहरण: Why These Tags Were Deprecated
<!-- Old: presentation mixed into markup -->
<font color="red">Warning text</font>
<!-- Modern: structure and style separated -->
<p style="color: red;">Warning text</p>
बदले जाने वाले टेक्स्ट स्टाइलिंग टैग्स
<font>, <basefont>, <big>, <tt>, और <strike> ये सभी markup में सीधे font family, size, color, या basic text effects control करते थे।
हर एक का सीधा CSS replacement है: <font> और <basefont> के लिए font-family/color/font-size, <big> के लिए font-size, <tt> के लिए font-family: monospace, और <strike> के लिए text-decoration: line-through (या semantic <s> element)।
उदाहरण: Text Styling Tags to Replace
<!-- Deprecated -->
<font size="5" color="blue">Big blue text</font>
<strike>Old price</strike>
<!-- Replacement -->
<span style="font-size: 20px; color: blue;">Big blue text</span>
<s>Old price</s>
बदले जाने वाले लेआउट टैग्स
<center> और <marquee>-era layout tags markup में सीधे specific visual positioning थोपते थे। <center> की जगह text-align: center (text के लिए) या margin: 0 auto (किसी block element को centre करने के लिए) इस्तेमाल होता है, जबकि deprecated attributes वाले table-based layouts की जगह पूरी तरह CSS Flexbox या Grid लेते हैं।
उदाहरण: Layout Tags to Replace
<!-- Deprecated -->
<center>Centered text</center>
<!-- Replacement -->
<p style="text-align: center;">Centered text</p>
बदले जाने वाले Frame और Embed टैग्स
<frame>, <frameset>, और <noframes> browser window को कई independently-scrolling documents में बाँटते थे, जो अब <iframe> (एक external document embed करने के लिए) या CSS Grid/Flexbox layouts (एक ही page को visual regions में बाँटने के लिए) से बदल दिए गए हैं। <applet> (Java applets) की जगह किसी बचे हुए plugin content के लिए <embed> या <object> इस्तेमाल होता है, हालाँकि आधुनिक web apps browser plugins से पूरी तरह बचते हैं।
उदाहरण: Frame and Embed Tags to Replace
<!-- Deprecated -->
<frameset>
<frame src="page1.html">
</frameset>
<!-- Replacement -->
<iframe src="page1.html"></iframe>
क्विक रेफरेंस: डिप्रिकेटेड टैग से मॉडर्न रिप्लेसमेंट
एक तेज़ lookup के रूप में: <acronym> से <abbr>, <applet> से <embed>/<object>, <basefont>/<font> से CSS font properties, <big>/<small> visual sizing से CSS font-size, <center> से CSS text-align/margin, <dir> से <ul>, <frame>/<frameset>/<noframes> से <iframe> या CSS layout, <strike> से <s> या <del>, और <tt> से <code> या CSS font-family: monospace।
उदाहरण: Quick Reference: Deprecated Tag to Modern Replacement
<!-- <acronym> -> <abbr> -->
<abbr title="HyperText Markup Language">HTML</abbr>
<!-- <tt> -> <code> -->
<code>console.log()</code>
- बिना यह realize किए कि <center>, <font>, या <marquee>-style tags सालों पहले deprecated हो चुके हैं, उन्हें रखने वाले पुराने code को नए project में copy-paste कर देना।
- यह मान लेना कि कोई deprecated tag "अभी भी ठीक काम करता है" इसका मतलब है कि वह valid है -- ज़्यादातर आज भी सिर्फ पुरानी websites के साथ backward compatibility के लिए browsers में render होते हैं, इसलिए नहीं कि उनकी सिफारिश की जाती है।
- किसी deprecated tag के CSS replacement को न जानना, और उसकी जगह clean, intended CSS property के बजाय inline styles को workaround की तरह इस्तेमाल करना।
- Deprecated tags visual styling को HTML markup में मिला देते थे; अब CSS वह सारी styling handle करता है।
- Browsers backward compatibility के लिए अभी भी ज़्यादातर deprecated tags render करते हैं, लेकिन वे HTML5 specification से बाहर हैं और नए code में इस्तेमाल नहीं होने चाहिए।
- हर deprecated presentational tag का एक सीधा CSS equivalent होता है जो ज़्यादा control देता है और styling को structure से अलग रखता है।
इस page के सभी tags backward-compatibility कारणों से अभी भी current browsers में render होते हैं, लेकिन कोई भी HTML5 specification का हिस्सा नहीं है और किसी को भी नए projects में इस्तेमाल नहीं करना चाहिए।
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: