locked
What are <!DOCTYPE html PUBLIC... and <html xmlns="http://www.w3.org/1999/xhtml" > ? RRS feed

  • Question

  • User1917887379 posted

    Hello,

     When I created a new master page, I got the following.  What are they?  What are they for?

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

    <html xmlns="http://www.w3.org/1999/xhtml" >


     Thanks,
    Jim

    Wednesday, September 27, 2006 9:48 PM

All replies

  • User1097734428 posted

    The DOCTYPE tells the browser what type of document it is loading, in this case it's a XHTML 1.0 Traditional document. This determines quite a bit in how the browser will render/treat your markup, as it should be able to assume how well your code is formatted based on the DOCTYPE. It also determines whether or not your page is considered valid. For instance, with XHTML 1.0 Traditional, if you have element attributes not enclosed in quotes, the page isn't valid. It ultimately doesn't matter to anyone unless they're concerned with the styling/validity of their markup.

     The xmlns on the html element is the namespace that qualifies what child elements are valid. This of it like a using statement for XML. It tells the browser that the html element can contain child elements of type: a, input, form, ect.
     

    Saturday, September 30, 2006 2:02 AM
  • User1917887379 posted

    Thanks Jonathan!  The information is helpful.

    Jim

    Wednesday, October 4, 2006 9:28 AM