I’m telling you that’s really weird situation :
I’m using Macromedia Dreamweaver 8 for PHP, HTML to code my sites. That’s not weird! When you start a new i.e. PHP or HTML file in Dreamweaver, the very first line of the code will be :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Now, I have created a header.php with that line (and some other lines too) to simply include it to other files of my site (i.e. index.php). Then I have a guestbook.php file with a form to let visitors leave their comments. In guestbook.php I don’t include the header.php file, instead I insert all the lines from the header file to guestbook.php ; I’ve noticed that FF, IE and Chrome don’t display the same guestbook.php when the line from above (!DOCTYPE…) is inserted :
in FF tables act as they want : row widths display totally out of control
IE doesn’t read the css correctly, etc.
Is there some unwritten rule I don’t know or what? I’m out of ideas how to solve this issue…
Thank you for your opinion!
Let me know if you need some code lines to see more clear!
dujmovicv, do you have a copy online? It’s hard for us to determine the issue if we can’t see it, though perhaps if you view the source code in a browser to ensure the doctype isn’t being added twice (or that something else is going funky). There’s no reason why your code should go wonky like that.
Does the source code look identical to how it should? If it’s not displaying identically I would assume either there’s some page specific CSS which is overriding the style or it’s something down to malformed source code (basically there’s either errors in the code or conflicting style).
At my code editor (M.Dreamweaver) the very first line of the code is :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
but when I open the page in the browser and look at the code :
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -->
I think HTML comment tags (<!-- –>) are added. That’s OK with FF, Opera, Google Chrome, but really weird layout in IE8 (as I described above)…
Any ideas?
The doctype tag has to be the very first thing in the HTML for IE to process it properly. You need to remove the comment. An HTML comment really ought to be inside the <html> tag anyway since outside of that there is nothing to say it is HTML.
Also with the doctype tag wrapped inside the comment tag any browser that does treat the comment as a comment will not see the doctype because it is commented out.
The main problem now is that when I add the <!Doctype line to the source code, IE displays the page correctly, but in all others (FF, Opera, Chrome) table rows gone ‘overflow’ outside of the table width… I tried to limit the row width with css style, with td width, nothing worked…