Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 300883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:57:17+00:00 2026-05-12T06:57:17+00:00

The following snippet, with or without the DOCTYPE declaration, renders the <pre> content slightly

  • 0

The following snippet, with or without the DOCTYPE declaration, renders the <pre> content slightly differently, i.e., the without-DOCTYPE version renders the <pre> content with less height.

<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" -->
<!-- "http://www.w3.org/TR/html4/strict.dtd"> -->
<html>
  <head>
  </head>
  <body>
    <pre>1</pre>
  </body>
</html>

What causes this difference?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:57:17+00:00Added an answer on May 12, 2026 at 6:57 am

    You, my friend, are seeing quirksmode in action.

    This has a long story behind it but to summarize it briefly:

    alt text
    (source: wikimedia.org)

    In the browser wars era (late 1990’s) every browser rendered html “its own way”. IE’s rendering was different from Netscape. By “rendering differently” I mean kind of what you are experiencing here.. only much, much, much worse.. a site you open in IE fine, would be just completely unusable in Netscape, because the tables would be skewed, or some button completely unreachable because it is off-screen or something.

    This resulted in pages that said things like “Best viewed in Internet Explorer 3.0” or “Best viewed in Netscape 4.0”. Lots of competition. Also icons like this:
    alt text
    (source: toastytech.com)

    All the while these people at W3C are publishing with improved “standards”. W3C kept saying “If each manufacturer stuck to the standard.. then we wouldn’t have any problems”. The W3C standard was supposed to be the CORRECT WAY to render HTML so it should look the same in all browsers. There is the the acid test to check css rules are implemented properly in the browser. If your browser implements it wrong it will look like a bloodspattered war scene (scroll down for sweet screenshots)..

    But Microsoft and Netscape were bent on destroying each other, so W3C’s calls to obey the standard were ignored..

    Quirksmode is the “old” rendering style of a browser. “Standards mode” is when the browser says “OK, we will do it the W3C way (the “right” way)”. Including a DOCTYPE at the top of your html page is a message to the browser that says “THIS PAGE is in standards mode, so please, render it in standards mode, and not your old quirky way.”

    So, your second example (with the plain <html> tag) renders in quirksmode because it lacks a DOCTYPE.

    The margin-top on the <pre> tag is different in quirks mode. Its smaller, in Firefox, at least. Other browsers it may be different.

    Try replacing your <pre> with

    <pre style=”margin:5px;”>1</pre>

    Both pages will look the same if you do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following snippet: public class a { public void otherMethod(){} public void doStuff(String
I have the following snippet in one of my html pages : <div class=inputboximage>
I am having the following code snippet to upload zip file without conversion to
The following HTML snippet is rendered with a whitespace between the two words (with
I have the following HTML snippet: <body> <div class=main> <div class=topBar> <p>testing</p> </div> <div
The following code snippet is from book Effective C#, public event AddMessageEventHandler Log; public
I have the following code snippet: public class A { public static void main(String[]
Consider the following code snippet below. class X { public String toString() { return
I have the following html snippet: <a href=page1.aspx class=title>page title goes here</a><br /> <span
Please consider the following snippet: public interface MyInterface { public int getId(); } public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.