Forum Moderators: open

Message Too Old, No Replies

Do I need the xmlns attribute?

About HTML tag

         

experienced

11:12 am on Mar 8, 2006 (gmt 0)

10+ Year Member



I have this line in all my pages. Is it right to b there or should i remove.

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

THis is simple HTML page only

Rgds

Robin_reala

11:28 am on Mar 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Remove it. It's setting a default namespace for XML-aware user agents. Or in English, useless if you're doing standard HTML.

experienced

11:45 am on Mar 8, 2006 (gmt 0)

10+ Year Member



Thanks for your reply.
basically this is the complete line -

<!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">

This is the autogenerated code by dreamweaver MX latest version thatsy i am little confused about the code. in the 1st line xhtml is also writen at last.

Now Should i have only this much

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

suggest plz..

Exp..

Scruffy

11:50 am on Mar 8, 2006 (gmt 0)

10+ Year Member



Dreamweaver! ('nuf said)

The doctype line you have there declares the page to be XHTML not HTML. So unless you really want to use XHTML (and confuse 9 out of 10 browsers), use the HTML strict doctype.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

experienced

11:58 am on Mar 8, 2006 (gmt 0)

10+ Year Member



Do you mean i must replace the old line to new your suggested line.

Thanks

encyclo

2:20 pm on Mar 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



confuse 9 out of 10 browsers

Using XHTML syntax won't confuse browsers at all. If Dreamweaver insists on specifying XHTML 1.0 Transitional that's just fine. You should leave the

xmlns
attribute in place as, whilst it has no real meaning unless serving the page as XML (a bad idea), it is part of the usual syntax when using XHTML.

The problem with simply changing to an HTML 4.01 (Strict or Transitional) doctype is that other markup generated by Dreamweaver is most likely to be XHTML rather than HTML (trailing slashes on line breaks and image elements, for example).

Just make sure the doctype line is on the very first line of your document with no comments or white space before it to ensure proper browser rendering. :)

experienced

4:07 pm on Mar 8, 2006 (gmt 0)

10+ Year Member



Thanks a lot :)