Obsolete Attributes
ID |
html.obsolete_attributes |
Severity |
low |
Remediation Complexity |
low |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Html |
Tags |
reliability |
Description
Flags an element that carries an obsolete presentational attribute such as align, bgcolor,
border, valign, cellpadding or cellspacing.
Rationale
These attributes encode styling directly in the markup. They were removed from the HTML standard in favour of CSS, which keeps presentation separate from structure, is easier to maintain and applies consistently across browsers. A page still relying on them is a maintenance and reliability risk.
<p align="center">Hi</p> <!-- FLAW — presentational attribute -->
<table bgcolor="red">...</table> <!-- FLAW — presentational attribute -->
<p class="centered">Hi</p> <!-- OK — styling via CSS -->
<td headers="h1">...</td> <!-- OK — semantic attribute -->
Remediation
Remove the presentational attribute and move the styling into a stylesheet, for example
text-align: center instead of align="center", or background-color: red instead of
bgcolor="red".