Content overlapping when change doctype from HTML to XHTML
I want to change my doctype to XHTML but it breaks all the content in my page, how to resolve the issue..?
I'll show you what was the change I've done on my document.
from this doc
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
It causes overlapping the content throughout the site, I'm shocked :( CSS styles are working, I mean in color and font sizes, but paragraphs widen to the right side.
Can anyone tell a solution..? I'm changing the doctype because something like a floating Ad is works only in X开发者_如何学GoHTML format in IE it doesn't support the HTML format that is why.
Thanks in advance!
Paul
See: http://hsivonen.iki.fi/doctype/
This doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
puts your page into Quirks Mode.
Unfortunately for you, your site has been made to work with Quirks Mode enabled - this was a fatal mistake.
The only sensible thing to do is to change the doctype to one that triggers (Almost) Standards Mode (such as the XHTML doctype in your question, or simply <!DOCTYPE html>
).
Then, you'll unfortunately have to go through the laborious task of fixing your site.
Doing this should help your site to render more consistently between different web browsers, and that's a worthy secondary incentive.
Unfortunately, you'll have to redesign your site completely (CSS- and design-wise). Then, sticking a standards/almost standards mode doctype (such as <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
) on your web page should work.
精彩评论