ifacethoughts

Align Can Invalidate Your Post In Future

I have seen lot of blog posts/articles using the align attribute for div, img, p elements while surfing. This has prompted me to bring this up with you. We will see later that it is not the matter of using just the align attribute but a lot of deprecated HTML elements and attributes.

In most of the blogging engines the document type is controlled by the templates part of the user interface. As most of us now know, all the webpages will eventually be migrated/upgraded to XHTML from HTML. The document type is typically set using one of the following declarations:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

These declarations mean that the document has to now comply with the restrictions of the specified document type to be qualified valid. This validity is significant not only for sytanx or semantic purpose, but the Search Engine Optimization (SEO) might be affected by it. The basic reason being that the search engine spiders or bots crawl through the HTML page and can perform better with valid web pages. Lorelle’s Improve Your SEO Standards With WordPress.com Blogs has a nice section on why Broken Code Breaks Search Engines.

Now, the XHTML Transitional declaration is something provided for enable transition from HTML 4.* to XHTML. XHTML Transitional allows certain deprecated HTML elements, which are rejected by XHTML Strict documents. Here is a nice document listing difference between the two. The final destination is to comply with XHTML Strict and not continue with the transitional version.

The templates, which define the document types can very well upgrade to XHTML Strict independent of the posts we write, but the webpage will invalidate if the posts that they display contain deprecated HTML elements. The validity of the webpage is not defined only by the template but also by our posts. I cannot imagine the effort to change every post to make it XHTML Strict compliant, whenever required in future, unless some tool does that for us. Is it wise to not use the HTML deprecated elements right now in the post so that it is easier to comply with stricter XHTML version later?

Technorati tags: , , , ,

Copyright Abhijit Nadgouda.

Discussion [Participate or Link]

  1. Collin said:

    Good evening!

    Just a quick note to say thanks for your comment on my blog, an apology for singling you out and hopefully a little further explanation now that I have calmed myself a little.

    http://www.cornellfinch.com/?p=242

    Collin

  2. Collin said:

    On this subject of this very blog post, if “align” will invalidate the xhtml, do you think there will be a way to achieve the align on an img tag without actually using “align”?

    It’s something I find useful and allows the text to flow without having to resort to a table.

    Of course, I am not an expert at HTML and there may already be a way to do it….

    Collin

  3. Abhijit Nadgouda said:

    Hi Collin,

    There are ways of doing it by using pure CSS. CSS: centering things on w3.org is a good guide for this.

    My post here is more of a question than a suggestion. The fact is that some day XHTML Strict will become the norm and then deprecated HTML elements can pose problems.

    Regards,
    Abhijit.

  4. Collin said:

    Indeed. What I currently use align for is to allow text to sit next to an image (usually a thumbnail in a blog as there’s so much wasted space that a full size image doesn’t fit…) rather than have a long line of thumbnails and then text.

    This page on my wp.com blog shows what I mean.

    I’ll go have a peek at the link now. Thanks!

  5. Collin said:

    As far as the question goes, when HTML dies and XHTML Strict(er) is the standard, should we be considering what comes after that and not use any XHTML code that may be deprecated on the next version?

    We’d end up never coding anythin! As with anything (buying a new PC for example, I think we just need to jump in and do it. Certainly a nod to the future will help with future standards, but we can’t write EVERYTHING with the future in mind. Hey, if we did that then in 10 years time there’d be no need for legacy programmers as it’s already written…

  6. Abhijit Nadgouda said:

    I agree that we cannot consider the future always, but we also cannot ignore certain facts that have been laid down. BTW, I would love if there are no legacy programmers 10 years later 🙂

  7. Dynamic And Rich But Not Without Text on iface thoughts said:

    […] This is a core part of accessibility where the information is still accessible to the user, using the alt attribute. An alt attribute is provided for every non-text element, even the anchor element has an alt attribute. In XHTML Strict doctype, the alt attribute is mandatory. […]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.