Performance: Avoiding deprecated tags
Using deprecated HTML tags affects browser rendering consistency and can cause layout shifts and slower page load times.
<h1 style="text-align: center;">Welcome</h1>
<center><h1>Welcome</h1></center>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using <center> tag | Adds extra DOM nodes | Multiple reflows due to layout shifts | Higher paint cost from unstable layout | [X] Bad |
| Using CSS text-align:center | No extra DOM nodes | Single reflow on style application | Lower paint cost with stable layout | [OK] Good |
<center> tag was used to center content but is now deprecated in favor of CSS styling.<section>, <article>, and <nav> are semantic HTML5 tags and are not deprecated.<b> is semantic<b> tag?<strong> tag is the semantic way to indicate important or bold text.<b> is deprecated for styling; <bold> is invalid; <em> and <i> are for emphasis and italic style, not bold.<center><h1>Welcome</h1></center>
<center> tag is deprecated in HTML5, modern browsers continue to support it for backward compatibility and will center the content.<h1> inside <center> will be rendered centered horizontally.<font color='red'>Warning!</font>
<font> tag is deprecated and should not be used for styling.<span> tag and apply color with CSS, e.g., style="color:red;".<center> and <font> are deprecated and should not be used.text-align:center; and font-style:italic; using the style attribute or external CSS on a semantic tag like <p>.Pass the test and this pattern moves unknown