Following site i have build always load in quirks mode which then rise the box model bug for older IE.
site
I have added the document type as xhtml1-strict.dtd and there is no white spaces or BOM characters. When i change the document mode to IE7 or IE8 standers from developer tools it shows the site correctly.
I have try to change the quirks mode loading in many ways but couldnt success. If you guys also dont know how to change to quirks mode loading i would appriciate if any hack to the alligment issue i am getting can be posted.
Thank You.
View source and your first line of code is:
<?xml version="1.0" encoding="UTF-8"?>
You need DOCTYPE to be the very first line.
Edit: You've removed the <?xml...>, but you still have an issue. Line 1 is blank but line 2 contains an invisible character - U+FEFF - the unicode BOM. You'll need to remove that.
Are you using Server-Side Includes or some other server technology that could be joining two files or otherwise adding to the response?
Your page starts exactly like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Lose everything before the DTD (including the blank lines before the xml declaration, which don't show correctly), and it should parse in standards mode.
Another solution is to use the X-UA-Compatible response header, like this:
X-UA-Compatible: IE=8
(or IE=7, or IE=9)
Finally, please do read the MSDN documentation on document compatibility -- it's the definitive resource on the subject.
Update:
Since you are using PHP, and you have a spurious Unicode BOM in your source, it's almost certain that one or more of your PHP source files include a BOM. You need to save them without a BOM and without any other characters before the <?php tag.
To make sure you got them all, write a short program that opens up PHP files and reads the first byte. If it's not '<', then something is probably wrong.
Alternatively, you can use the X-UA-Compatible header as I mention above.
If a doctype that triggers strict mode is preceded by an xml prolog, the page shows in quirks mode.
It looks like the code output does.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
Related
A very simple HTML file. I deliberately placed all required attributes even though it may be an overkill. (Actually, é is recognised by practically all browsers without explicit specification, but this is just an example to highlight the problem):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!ENTITY eacute "é">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>Test HTML with an entity</title>
</head>
<body lang="en">
<h1>Résumé</h1>
</body>
</html>
When I open it in a browser (I tried Firefox, Chrome, IE and Android WebView), it always comes up as
]>
Résumé
and I can't see a reason why ]> appears. Of course, it I remove ]> in DOCTYPE, everything appears all right,
but in this case my html is not a valid xml file, so it gives an error when opened in DOM.
Any suggestions?
What you are doing is correct as per XML rules, and it actually works in browsers that support XML, when served as XML; cf. How do I define HTML entity references inside a valid XML document?
The problem is that if the document is opened as legacy HTML in a browser, it will be processed by legacy HTML principles. This means, among other things, that an internal DTD subset (the thing you have in brackets in the DOCTYPE declaration) is not parsed by the book; instead, when processing a DOCTYPE string, browsers end with the first > character, and the rest will be consumed as character data.
So the problem isn’t just the ]>. The construct does not work at all, i.e. no entity is defined. In the example, the “é” character is displayed, but only because é is predefined in HTML. If you tried defining <!ENTITY foo "é"> and using &foo;, you would see &foo; literally.
If your document will be processed as legacy HTML, you cannot define entity references. Apparently it currently is, since the example document does not display at all when processed as XML (it is not well-formed, so only a syntax error message appears).
My pages are written and declared as XHTML 1.0 Strict. The first lines goes like this:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Which I belive is correct for a XHTML 1.0 Strict but nevertheless IE11 gives this warning:
HTML1406: Invalid tag start: "<?". Question marks should not start tags. File: default.aspx, Line: 1, Column: 2
Anyone know if this is somthing I should worry about?
The problem is that although you have created a file with an XHTML doctype you have served it using a text/html media type.
So IE11 (and other browsers) treat the file as an HTML file and parse it with their HTML parser. An XML declaration in an HTML file is invalid, and that's what the browser is telling you. If you had served the file with an application/xhtml+xml media type, the browser would have treated the file as XHTML and used its XML parser to parse it. Then the XML declaration would be handled correctly according the XML rules and IE11 would not give you that warning message.
There's no real problem here. The HTML parser will treat the declaration as a bogus comment and just carry on regardless.
For more information you should read Sending XHTML as text/html Considered Harmful and/or HTML 4, HTML 5, XHTML, MIME types - the definitive resource
If you got here because you're working on an old(er) ASP.NET Web Forms app/site... try turning on Compatibility View... that worked for me
No matter what I try to do, pages keep looking significantly different depending on whether they are from my local machine or the development server. When pressing F12, I've finaly noticed that pages have different instructions on the top:
1) Pages displayed by my local machine have the following values:
Browser Mode: IE9 Compatible View
Document Mode: Quirks
HTML starts with this line of code
<html xmlns="http://www.w3.org/1999/xhtml">
2) Whereas pages displayed by the development server have the following values:
Browser Mode: IE9 Compatible View
Document Mode: IE7 Standards
HTML starts with this line of code
<!-- 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">
It looks like the the first line of the instruction that's making those pages to display differently.
Do I need to add that line to pages coming from my local machines as well? Why and how to do that?
Thanks for helping
Without a doctype, you are in quirks mode, and, no matter what else you do, pages won't look the same as in strict mode.
New web pages should always have a doctype and always use strict. Rarely would a newly created page have a need for quirks or the transitional doctype you are using.
Add either that transitional doctype on your first line or, preferably, the strict version:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Better yet, use the new type: <!DOCTYPE html> which will keep all browsers in strict mode, including IE back to IE6 (or even IE4? Don't recall).
I am building a webpage, and I found a problem which I cannot solve. If I declare the DOCTYPE, the page breaks completely, and if I don't declare it, the IE version won't work properly (the drop down menus won't drop). But, despite of it's broken, if I declare the DOCTYPE, the dropdown menus work at every explorer, including IE. So I really don't know what to do, any idea? I'm currently declaring the DOCTYPE as: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> but I've tried other options and they don't work neither.
Last time I posted here the free server blocked the page (probably too many users, as I'm the only one getting in currently), but these are 2 examples of the page:
with DOCTYPE: http://newfutureuniversity.org/project/
without DOCTYPE (dropdown menus not working with IE9):
http://newfutureuniversity.org/learn/
Any help would be appreciated. Even if it's just to orientate me about where to start searching, as I could't find anything similar.
Using or not using the doctype for modern web pages is no longer optional and is required. It is the very first thing that goes down on a page and never changes. If you created a page without one to begin with, then your whole page is set in quirks mode. Trying to fix it or change it by adding/removing the doctype is, essentially, changing the rules and the target as you go along.
Trying to use jQuery to fix this now is just sinking you into a deeper hole. Add the doctype, use a modern browser to get everything how you want it (IE is not a modern browser), then work on getting IE to follow along.
The charset you should be using is <meta charset="utf-8">
for HTML5 it is nice and small, you have an XHTML declaration
it can simply be:
<!DOCTYPE html>
for HTML 5
Using XHTML tells the parser to be much more strict in what it accepts. you have no <html> root in your document (HTML5 won't care about this).
content type specification is different in HTML5 as well
instead of <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> you can use <meta charset="iso-8859-1" /> if that is your desired character set.
I was in a hurry to churn out some html code and did not provide a DTD tag for my index.htm file...does anyone know what DTD is used by default when no tag is provided?
The reason I ask is that when I add in my chosen type of
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
the page is distorted and I want to go in and fix it. My code follows the guide lines given for XHTML at
Thanks!
Browsers don't "fake" a doctype they parse in "quirks mode". Quirks mode assumes the web page was written a while ago and never updated, so it attempts to render it in the same way an older version of the browser would have in order to attain backwards compatibility.
In Internet Explorer, rendering in quirks mode makes the page appear the same as it would have in IE 5.5.