← Back to HTML Course | Chapter 9: Reference & Advanced | Lesson 9 of 9

HTML डिप्रिकेटेड टैग्स

HTML 1990 के दशक की शुरुआत से लगातार evolve होता रहा है, और इस दौरान शुरुआती tags का एक batch -- ज़्यादातर वे जो visual styling को सीधे markup में मिला देते थे -- आधिकारिक तौर पर deprecated कर दिए गए, जब CSS presentation handle करने का standard तरीका बन गई। Browsers अभी भी backward compatibility के लिए इनमें से ज़्यादातर पुराने tags को render करते हैं, लेकिन ये HTML5 specification का हिस्सा नहीं हैं, इसलिए नए projects में इन्हें कभी इस्तेमाल नहीं करना चाहिए।

ये टैग्स डिप्रिकेट क्यों किए गए

शुरुआती HTML में content structure और visual presentation एक ही tags में मिले-जुले होते थे, यानी किसी page की styling सीधे उसके markup में ही बेक हो जाती थी।

जैसे-जैसे CSS एक पूर्ण, dedicated styling language के रूप में विकसित हुई, HTML ने ज़्यादातर presentational tags को deprecate कर दिया ताकि structure (HTML) और style (CSS) को साफ-साफ अलग रखा जा सके -- यह सिद्धांत sites को maintain और restyle करना आसान बनाता है।

Note: अगर आपको deprecated tags से भरा कोई पुराना codebase मिलता है, तो इसे उस styling को धीरे-धीरे CSS में migrate करने का एक मजबूत संकेत मानें, न कि इसे और आगे बढ़ाने का।
Warning: कोई tag आज भी आपके browser में render हो रहा है, इसका मतलब यह नहीं कि आगे इस्तेमाल करना safe है -- browsers पुराने tags को सिर्फ दशकों पुरानी websites के साथ backward compatibility के लिए काम करते रहने देते हैं।

उदाहरण: Why These Tags Were Deprecated

markup
<!-- 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)।

Note: पुराने markup को migrate करते समय, <font color="..." size="...">text</font> को एक styled <span> या CSS class से बदलें -- पुराने tag को वहीं मत छोड़ें।
Warning: <strike> को अभी भी valid <s> element के साथ confuse करना आसान है -- <strike> deprecated है, जबकि <s> (एक अलग, अभी भी supported tag) इसका modern equivalent है।

उदाहरण: Text Styling Tags to Replace

markup
<!-- 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 लेते हैं।

Note: किसी भी <center> tag की जगह CSS में text-align: center इस्तेमाल करें, या अगर आप किसी block-level container को center कर रहे हैं तो margin: auto के साथ एक तय width जोड़ें।
Warning: पुराने table-based page layouts (tables को tabular data की बजाय सिर्फ visual positioning के लिए इस्तेमाल करना) एक outdated practice मानी जाती है, हालांकि <table> tag खुद actual data के लिए पूरी तरह valid बना हुआ है।

उदाहरण: Layout Tags to Replace

markup
<!-- 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 से पूरी तरह बचते हैं।

Note: अगर आपको कोई <frameset>-based layout दिखे, तो उसे <iframe> या किसी CSS-based multi-panel layout से पूरी तरह redesign करने की ज़रूरत है -- इसका कोई सीधा drop-in replacement नहीं है।
Warning: <applet> Java plugin पर निर्भर था, जिसे अब कोई भी modern browser बिल्कुल भी support नहीं करता, जिससे बचा हुआ कोई भी applet-based content आज पूरी तरह non-functional हो चुका है।

उदाहरण: Frame and Embed Tags to Replace

markup
<!-- 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।

Note: किसी पुराने codebase को audit करते समय यह mapping हाथ में रखें -- ज़्यादातर deprecated-tag migrations एक सीधा one-to-one स्वैप होते हैं, किसी CSS property या अब भी valid semantic tag में।
Warning: इनमें से कुछ deprecated tags (जैसे frameset) को एक simple one-to-one swap की बजाय structural redesign की ज़रूरत होती है, क्योंकि इनका पूरा layout model बदल दिया गया है।

उदाहरण: Quick Reference: Deprecated Tag to Modern Replacement

markup
<!-- <acronym> -> <abbr> -->
<abbr title="HyperText Markup Language">HTML</abbr>
<!-- <tt> -> <code> -->
<code>console.log()</code>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.