This is a generic error page which should help you in general with errors of this type. Refer below to the specific examples for more precise advice.

How to fix: The X attribute on the Y element is obsolete. Use CSS instead.

Most Likely Cause and Fix

Your HTML5 markup contains a <Y> element with a X attribute in the form:

<Y X="foo" … />

This attribute is no longer present in HTML5. You should use CSS to achieve the same effect:

<Y style="<use-relevant-CSS-rule>" … />

What This Error Means

There are three aspects to a web-based document:

  • Structure: the underlying arrangement of the document and the elements contained within; handled by HTML

  • Presentation: how elements look and where on the page they're placed; handled by CSS.

  • Behaviour: how the elements respond when being interacted with; handled by JavaScript (in general)

The appearance of and placement text and other page elements is a presentational matter and as such is best implemented at the presentational layer and handled by CSS.

HTML5 follows this approach and removes various presentational attributes previously specified on elements in markup in preference of CSS rules that can achieve the equivalent effect.

This error is letting you know that you have presentational markup in your HTML that is no longer valid and that you should instead remove such attributes and apply relevant CSS rules.

How To Fix It

For text alignment within elements

Use the CSS text-align property:

<h1 style="text-align:center;">Example</h1>

in preference of outdated presentational markup:

<h1 align="center">Example</h1>

In general

There is no general solution as the changes you need to make are dependent on the elements on which you used obsolete presentational attributes, the attributes that were used and the expected outcome.

Ensure all presentational aspects of your document are handled not in markup but in CSS.

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus