Obsolete Elements
Deprecated tags, why to avoid them, and modern alternatives.
Overview
Many HTML elements are deprecated and should not be used.
Key Concepts
- Deprecated Tags β Elements removed from spec
- Why Deprecated β Accessibility, semantics, maintainability
- Modern Alternatives β CSS and semantic replacements
- Browser Support β May still work but shouldn't be used
- Migration β Updating old code
Code Examples
<p style="text-align: center;">Centered with CSS</p>
<p style="color: red; font-size: 1.5rem;">Colored with CSS</p>
<p class="marquee">Scrolling with CSS animation</p>
<p class="blink">Blinking with CSS animation</p>
<p><s>Strikethrough</s> or <del>deleted</del></p>
<p class="big">Big text</p>
<p class="small">Small text</p>
<div class="layout">
<header>Header</header>
<main>Content</main>
<aside>Sidebar</aside>
<footer>Footer</footer>
</div>
<style>
.marquee {
animation: marquee 10s linear infinite;
}
@keyframes marquee {
0% { transform: translateX(100%); }
100% { transform: translateX(-100%); }
}
.blink {
animation: blink 1s step-end infinite;
}
@keyframes blink {
50% { opacity: 0; }
}
.big { font-size: 1.5em; }
.small { font-size: 0.875em; }
.layout {
display: grid;
grid-template: "header header" auto "main aside" 1fr "footer footer" auto / 1fr 300px;
min-height: 100vh;
}
header { grid-area: header; }
main { grid-area: main; }
aside { grid-area: aside; }
footer { grid-area: footer; }
</style>
Practice
Refactor a legacy page to replace obsolete elements with modern CSS.