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 4272634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:36:15+00:00 2026-05-21T07:36:15+00:00

Is it necessary to write <html> , <head> and <body> tags? For example, I

  • 0

Is it necessary to write <html>, <head> and <body> tags?

For example, I can make such a page:

<!DOCTYPE html>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Page Title</title>
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <script src="js/head_script.js"></script><!-- this script will be in head //-->


<div>Some html</div> <!-- here body starts //-->

    <script src="js/body_script.js"></script>

And Firebug correctly separates head and body:

Enter image description here

The W3C validator says it’s valid.

But I rarely see this practice on the web.

Is there a reason to write these tags?

  • 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-21T07:36:16+00:00Added an answer on May 21, 2026 at 7:36 am

    Omitting the html, head, and body tags is certainly allowed by the HTML specifications. The underlying reason is that browsers have always sought to be consistent with existing web pages, and the very early versions of HTML didn’t define those elements. When HTML first did, it was done in a way that the tags would be inferred when missing.

    I often find it convenient to omit the tags when prototyping and especially when writing test cases as it helps keep the markup focused on the test in question. The inference process should create the elements in exactly the manner that you see in Firebug, and browsers are pretty consistent in doing that.

    But…

    Internet Explorer has at least one known bug in this area. Even Internet Explorer 9 exhibits this. Suppose the markup is this:

    <!DOCTYPE html>
    <title>Test case</title>
    <form action='#'>
       <input name="var1">
    </form>
    

    You should (and do in other browsers) get a DOM that looks like this:

    HTML
        HEAD
            TITLE
        BODY
            FORM action="#"
                INPUT name="var1"
    

    But in Internet Explorer you get this:

    HTML
        HEAD
           TITLE
           FORM action="#"
               BODY
                   INPUT name="var1"
        BODY
    

    See it for yourself.

    This bug seems limited to the form start tag preceding any text content and any body start tag.

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

Sidebar

Related Questions

I'm currently writing a function for parsing some HTML and adding tags where necessary.
Problem statement: It is necessary for me to write a code, whether which before
Sometimes it is necessary to compare a string's length with a constant. For example:
I have a page which displays a form that a logged-in user can use
Can someone write me the full code to show me how I can fade
is it really necessary to write code in JSP in client side and handle
I have the following HTML page: <div id=foobar> <?php echo $dynamicVar; ?> </div> <input
I generate a HTML-Page from C#. In the HTML-Page there are a lot of
I am going to write a big website, it has hundreds of HTML pages.
I'd like to be able to write a fraction using HTML/CSS/jQuery (rather than using

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.