Sobes.tech
Middle

What is quirks mode (compatibility mode)?

sobes.tech AI

Answer from AI

Quirks mode is a rendering mode for web pages where browsers emulate the behavior of older browsers (such as Netscape 4 or Internet Explorer 5) to ensure backward compatibility with web pages written with their quirks and errors in mind.

Main characteristics of quirks mode:

  • Non-standard box model: In some browsers in quirks mode, padding and border are included in the total width of the element.
  • Non-standard behavior of float and vertical-align: Errors or unpredictable behavior of CSS properties related to alignment and wrapping may occur.
  • Differences in font and size handling: CSS rules for determining font sizes and other elements may be applied incorrectly.
  • Lack of support for modern standards: Some CSS3 and HTML5 features may be unavailable or function incorrectly.

Browsers switch to quirks mode if the web page does not have a correct doctype or if the doctype is specified in an outdated format. Having a complete and correct DOCTYPE (e.g., <!DOCTYPE html>) switches the browser to standard rendering mode (standards mode).

Example of a correct DOCTYPE for standard mode:

<!DOCTYPE html>