Some HTML attributes are habits rather than requirements. They used to patch browser inconsistencies, support old JavaScript patterns, or mimic behavior that is now native. In 2026, keeping them can make markup noisier, harder to maintain, and occasionally less accessible.

This guide focuses on attributes that are obsolete, redundant, or better handled by CSS and modern web APIs. It is not a call to remove every attribute you recognize: semantic, validation, form-associated, and accessibility attributes still matter. The goal is to stop writing the ones that add no value.
1. Stop adding type="text" to ordinary text inputs
An <input> without a type attribute defaults to type="text". That behavior is specified in HTML and supported across browsers.
<!-- Noisy -->
<input type="text" name="full_name" id="full_name">
<!-- Fine -->
<input name="full_name" id="full_name">
Do not overcorrect, though. Explicit types such as email, password, number, date, checkbox, and radio are useful. They change input behavior, mobile keyboards, validation, and assistive-tech semantics. The only safe one to omit is the plain text default.

2. Stop using charset values other than UTF-8 workarounds
Very old pages sometimes carried legacy encoding declarations, numeric escape-heavy patterns, or server-driven character encoding assumptions. For modern pages, declare UTF-8 once, early in the document head, and move on.
<meta charset="utf-8">
Place it before content that may include non-ASCII characters. Also send the encoding through HTTP headers or hosting configuration if you control the server. Do not sprinkle multiple charset declarations across the page; the first one wins, and conflicting declarations create confusing debugging sessions.
3. Stop styling with border, cellpadding, cellspacing, width, height, and align
Presentational table attributes belong in last decade's email-template survival kit, not modern web app markup. On the web, CSS is easier to override, inspect, and keep consistent.
<!-- Avoid for web pages -->
<table border="1" cellpadding="8" cellspacing="0" width="100%" align="center">
<tr>
<td width="120" align="left">Name</td>
</tr>
</table>
The replacement is straightforward:
.data-table {
width: 100%;
border-collapse: collapse;
background: #fff;
}
.data-table th,
.data-table td {
padding: 0.625rem 0.75rem;
text-align: left;
border-bottom: 1px solid #e5e7eb;
}
.data-table th:first-child,
.data-table td:first-child {
width: 8rem;
}
There is one exception: HTML email templates may still need presentational attributes because email clients have uneven CSS support. For a normal website or app, keep presentation in CSS.
4. Stop using bgcolor, text, link, vlink, and alink on body
These attributes control colors from markup and are easy to forget when theming changes. Pseudo-classes and CSS custom properties handle the same job more predictably.
<!-- Avoid -->
<body bgcolor="white" text="#111" link="blue" vlink="purple" alink="red">
Use CSS instead:
:root {
--page-bg: #ffffff;
--page-text: #111827;
--link: #2563eb;
--link-visited: #7c3aed;
--link-active: #dc2626;
}
body {
background: var(--page-bg);
color: var(--page-text);
}
a {
color: var(--link);
}
a:visited {
color: var(--link-visited);
}
a:active {
color: var(--link-active);
}
This also makes dark mode much less painful:
@media (prefers-color-scheme: dark) {
:root {
--page-bg: #0b0f17;
--page-text: #e5e7eb;
}
}
5. Stop using the style attribute for repeated component styling
style is not obsolete. It is perfect for dynamic values that JavaScript knows at runtime, such as positioning a tooltip or setting a progress bar width.
<div class="progress" role="progressbar" aria-valuenow="64" aria-valuemin="0" aria-valuemax="100">
<span class="progress__fill" style="width: 64%"></span>
</div>
What you should avoid is copying the same inline declarations across dozens of elements. They cannot use media queries, pseudo-classes, or design tokens cleanly, and specificity makes one-off fixes annoying.
<!-- Avoid repeating this -->
<button style="border:0;border-radius:10px;padding:10px 14px;background:#2563eb;color:#fff">
Save
</button>
Use a class:
.btn-primary {
border: 0;
border-radius: 0.625rem;
padding: 0.625rem 0.875rem;
background: var(--color-primary);
color: var(--color-on-primary);
}
.btn-primary:hover {
background: color-mix(in srgb, var(--color-primary), black 12%);
}
6. Stop using language="javascript" and XML-style script leftovers
You do not need language="JavaScript" on script tags. Browsers already treat scripts as JavaScript by default. Also avoid self-closing script syntax borrowed from XHTML; a script element needs a real closing tag.
<!-- Avoid -->
<script language="JavaScript" src="/assets/app.js" />
<!-- Use -->
<script type="module" src="/assets/app.js"></script>
For inline scripts, omit the type unless you need a special type such as module or a data block.
<script type="application/json" id="settings">
{ "locale": "en-US" }
</script>
7. Stop relying on name="..." for element lookup in JavaScript
Old scripts sometimes referenced named form controls or elements through generated global variables. That behavior is fragile and confusing, especially when names collide with existing window properties.
// Avoid this style
const value = window.orderForm.email.value;
Use stable selectors, FormData, or the form elements API.
<form id="checkout-form">
<label>Email <input name="email" type="email" required></label>
<button>Continue</button>
</form>
const form = document.querySelector('#checkout-form');
form.addEventListener('submit', (event) => {
event.preventDefault();
const data = Object.fromEntries(new FormData(form).entries());
console.log(data.email);
});
Keep name on form controls because it is essential for form submission. Just stop treating it as a JavaScript variable declaration.
8. Stop using target="_blank" without a safe rel policy
This one is not obsolete, but the bare attribute is often a trap. When a linked page can open with target="_blank", add a relationship value that matches the behavior you need.
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
Open example
</a>
Modern browsers handle much of the noopener risk automatically, but being explicit still communicates intent, especially in shared codebases and older embedded web views. If the link is external and opened in a new tab, this pattern remains useful.
9. Stop adding async="async" or defer="defer" as if XHTML validation mattered
Boolean attributes do not need a repeated value in HTML5 syntax.
<!-- Verbose -->
<script defer="defer" src="/assets/app.js"></script>
<!-- Equivalent HTML -->
<script defer src="/assets/app.js"></script>
The same applies to disabled, checked, required, readonly, multiple, and selected. Do not write checked="true"; the mere presence of the attribute makes it true. To remove it, remove the attribute itself.
10. Stop replacing semantic attributes with ARIA
Developers sometimes add ARIA to compensate for using the wrong element. The better fix is usually the native element.
<!-- Avoid -->
<span role="button" tabindex="0" class="btn" id="save">Save</span>
<!-- Use -->
<button type="button" class="btn" id="save">Save</button>
A native button gives you keyboard interaction, focus behavior, click semantics, and a sensible accessibility name without extra attributes. Likewise, use <nav>, <main>, <label>, heading levels, and the correct input types before reaching for ARIA.
Do not remove useful ARIA, though. aria-label, aria-expanded, aria-live, and relationship attributes are often necessary. The rule is simple: prefer built-in semantics first; add ARIA only when native HTML cannot express the state or relationship.
A lean modern HTML starter template
Here is a compact template that avoids the common legacy baggage while keeping useful behavior explicit.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lean HTML template</title>
<meta name="description" content="A clean starting point for a modern web page.">
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<main class="page">
<h1>Sign in</h1>
<form id="signin-form" class="form">
<label class="field">
Email
<input name="email" type="email" autocomplete="email" required>
</label>
<label class="field">
Password
<input name="password" type="password" autocomplete="current-password" required>
</label>
<label class="checkbox">
<input type="checkbox" name="remember">
Remember me
</label>
<button class="btn-primary" type="submit">Sign in</button>
</form>
</main>
<script type="module" src="/app.js"></script>
</body>
</html>
Quick cleanup checklist
- Remove redundant
type="text"only from plain text inputs. - Move table spacing, borders, alignment, and dimensions to CSS.
- Replace legacy color attributes with CSS custom properties.
- Reserve inline styles for dynamic, per-element values.
- Drop
language="javascript"and XHTML-style script self-closing. - Use
querySelector,FormData, and the form elements API instead of named globals. - Keep new-tab links intentional and include the appropriate
relvalue. - Write boolean attributes without fake
truevalues. - Prefer native semantic elements before adding ARIA.
The bigger rule
HTML should encode structure, state, and meaning; CSS should own visual design; JavaScript should handle behavior that HTML and CSS cannot. When an attribute is only there because it was needed in an old browser, check whether the platform now handles it natively.
The cleanest markup is not markup with fewer attributes at any cost. It is markup where every remaining attribute earns its place.