Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Validation and "quirks" mode.

Status
Not open for further replies.

tommyc7

Programmer
Feb 3, 2007
33
US
I have 2 part question about how the browser's validation on a web page. Here's the basic scenario:

Suppose you have a page that validates perfectly in either HTML 4.01 strict or XHTML 1.0 strict. Now say you want to add a piece of code that you received from an external source, say you're placing an Ad on your page. For whatever reason, that code snippet will not validate, even as transitional.

Question 1:

My understanding is that if any part of the page won't compile, then the browser goes into quirks mode. What exactly is the "danger" of quirks mode? What makes it so bad?

Question 2:

Is there a way to block off the "bad" section of code so that the browser knows that the rest of the page is good, but just use quirks mode for just that section?


Thanks!
Tom

 
My understanding is that if any part of the page won't compile, then the browser goes into quirks mode.

That is not how I understand it; the complete doctype (or lack thereof) should determine the mode.

What exactly is the "danger" of quirks mode? What makes it so bad?
In IE, especially, the box model is completely different; it adds default margins and paddings, giving you (perhaps) unexpected results. Tables do not inherit styles from the body, etc. etc. Additionally, IE and Mozilla simply display differently in quirks mode.

If you are getting a piece of code for an ad, you can either modify it so it does validate or simply not worry about it. i'm a big fan of validation, but sometimes you cannot control 3rd party rss feeds or ads or whatever.


Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Greg is right. Non-validating code does not switch between quirks and standards mode. Doctype will determine which mode the browser will use. The browser will be choking on the non-valid code, but most browsers will manage to properly render smaller, individual pieces of non-valid code. It is having it all intertwined that causes more issues.

Besides, what is the problem with the validation? Is it just capital letters in attributes or quoted values or is it something more serious as code not being well formatted?

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top