Skip to main content

Deprecated Code - Why You Should Avoid It

If you're perusing one of my articles on blog coding, for instance Centering Complex and Multiple Objects, and you follow my advice to read the W3 Schools tutorials for further advice, you'll find a lot to read. They give you good canonical definitions of each HTML tag, and interactive exercises so you can see what each one actually does.

If you're reading about the <center> tag, you'll note the advice
The center element was deprecated in HTML 4.01.
The center element is not supported in XHTML 1.0 Strict DTD.

If you're not blocking popups from http://www.w3schools.com, you'll note a popup window advising you that
A deprecated element or attribute is one that has been outdated.
Deprecated elements may become obsolete in the future, but browsers should continue to support deprecated elements for backward compatibility.

In other words, you can keep using <center> ... </center> right now, but one day in the future, it may stop working. No guarantee when, either.

In HTML, an element is deprecated only when there is a replacement for it. In this case, this is a good replacement. The <center> ... </center> tags are known to display differently in Firefox and Internet Explorer.

For <center> ... </center>, you're advised
Use CSS styles to center text!

I use
<span style="text-align:center;"> ... </span>
to center text, for instance. You can use the
<span> ... </span>
pair within a paragraph, or wherever else convenient. And if you want to center graphic objects, or multiple text objects, relative to each other, you can use nested tables.

>> Top

Comments

Mary said…
Good to know! Thanks!

Popular posts from this blog

Adding A Link To Your Blog Post

Occasionally, you see a very odd, cryptic complaint I just added a link in my blog, but the link vanished! No, it wasn't your imagination.

Embedded Comments And Main Page View

The option to display comments, embedded below the post, was made a blog option relatively recently. This was a long requested feature - and many bloggers added it to their blogs, as soon as the option was presented to us. Some blog owners like this feature so much, that they request it to be visible when the blog is opened, in main page view. I would like all comments, and the comment form, to be shown underneath the relevant post, automatically, for everyone to read without clicking on the number of comments link. And this is not how embedded comments work.

What's The URL Of My Blog?

We see the plea for help, periodically I need the URL of my blog, so I can give it to my friends. Help! Who's buried in Grant's Tomb, after all? No Chuck, be polite. OK, OK. The title of this blog is "The Real Blogger Status", and the title of this post is "What's The URL Of My Blog?".