Forum Moderators: open

Message Too Old, No Replies

HTML to XHTML conversion

HTML to XHTML conversion issues

         

shalj

6:53 pm on May 17, 2007 (gmt 0)

10+ Year Member



Hi, I converted my HTML code to XHTML. The pages that were shown as left aligned in HTML have now become center aligned.I searched for the cause but couldnt find.If anyone could plz help and guide me as to why this alignment has changed to center aligned.
one thing more wats the significance of this line in XHTML code:
<html xmlns="http://www.w3.org/TR/xhtml1>
wat if we donot include this line in our html head in converted code?

tomda

6:57 pm on May 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let me suggest that you validate your page with the W3C XHTML Validator to clear any errors you may have done.

webable

8:03 pm on May 19, 2007 (gmt 0)

10+ Year Member



Without the xmlns="http://www.w3.org/TR/xhtml1 part in the html tag the page will not be treated as xhtml. Regardless of the xhtml doctype.

encyclo

8:55 pm on May 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld shalj and webable!

The difference you are seeing is due to the doctype, not the

xmlns
attribute. When using a complete doctype such as one for XHTML, the page is rendered using a standards-compliance mode where the W3C standards are more closely followed than for legacy HTML. See the following thread for more information:

  • Quirks Mode vs. Standards Mode - overview [webmasterworld.com]

    For the

    xmlns
    attribute you mention, it has no meaning when you serve your XHTML with a HTML MIME type - which is almost always the case. In pure XML, the attribute defines the namespace for the XHTML markup. To conform to XHTML standards you should keep it despite its redundancy, or alternatively you can use HTML 4 and avoid the need for it altogether.
  • webable

    7:15 am on May 20, 2007 (gmt 0)

    10+ Year Member



    encyclo > Thanks for the clarification!