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

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?".

Add A Custom Redirect, If You Change A Post URL

When you rename a blog, the most that you can do, to keep the old URL useful, is to setup a stub post , with a clickable link to the new URL. Yo! The blog is now at xxxxxxx.blogspot.com!! Blogger forbids gateway blogs, and similar blog to blog redirections . When you rename a post, you can setup a custom redirect - and automatically redirect your readers to the post, under its new URL. You should take advantage of this option, if you change a post URL.

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.