answersLogoWhite

0


Best Answer

Code in the head tag will be executed before that in the body, because of the order of page loading. Additionally, anything written to the body using the document.write method goes in the position of a script tag in the body

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Javascript in the head of an HTML document is run before the body loads, while any Javascript in the body of an HTML document is run after all the elements above it have been loaded, meaning that, using the following code:

<html>

<body>

start text

<script type="text/javascript">

document.writeln("this is inserted text");

</script>

end text

</body>

</html>

"start text" would be loaded first, then the script would run, which would write "this is inserted text" after "start text" but before "end text", then, finally, "end text" will load.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

The <HEAD> tag is used to display the heading information like company name, page title etc in the web page

The <BODY> tag is used to display the body of the web page - which contains all the contents you want to display

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

There isn't much of a difference. They are both javascript code and can be referred to anywhere inside the program.

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

The head contains JavaScript, favicons, styles, etc..

The body has text and images.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Head is for the title and the icon. Body is what you see in the window.

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

The head is where headings, JavaScript, and CSS styles, can go.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between head tag and body tag in HTML?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the skeleton for an HTML based webpage?

&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;


What are the Two main parts of an HTML document?

Heading, denoted by the tages &lt;head&gt; &lt;/head&gt; and body denoted by &lt;body&gt; &lt;/body&gt;


Can a TITLE tag can be used in any section of a webpage?

No, it must be used in the section of your HTML document. Here is an example of how to use it: &lt;html&gt; &lt;head&gt; &lt;title&gt;Web Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;


Why you use body tag?

You need to use a &lt;body&gt; tag because it defines the main body section of an HTML document. Here are the minimum tags required to create a web page: &lt;html&gt; &lt;head&gt;&lt;title&gt;My Page&lt;/title&gt;&lt;/head&gt; &lt;body&gt; Hello World! &lt;/body&gt; &lt;/html&gt;


What is the HTML code needed for a website that displays Hello World?

No code is needed. If you wanted to, you could just make a blank HTML page and write "Hello world" on it with out any HTML code. Tumudracs improved answer: If you want to be a true HTML coder here is the code: &lt;HTML&gt; &lt;head&gt; &lt;title&gt; Hello World &lt;/title&gt; &lt;/head&gt; &lt;body&gt; Hello World &lt;/body&gt; &lt;/HTML&gt; If you wanna get technical, it would be &lt;! DOCTYPE HTML PUBLIC "-//W3C DTD HTML 4.01//EN" "http://www.w3c.org/TR/html14/strict.dtd"&gt; &lt;HTML&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-1"&gt; &lt;title&gt;Hello World&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt; Hello World &lt;/p&gt; &lt;/body&gt; &lt;/HTML&gt;

Related questions

How do you prepare an HTML?

The basic HTML base to a HTML website is &lt;HTML&gt; &lt;title&gt; &lt;/title&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/HTML&gt;


What is the skeleton for an HTML based webpage?

&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;


What is process of properly ordering HTML tags?

&lt; html &gt; &lt; head &gt; &lt;/ head &gt; &lt; body &gt; &lt;/ body &gt; &lt;/ html &gt; Without spaces.


What are the basic elements of HTML document?

HTML head title /title meta style /style /head body /body /HTML


What is the effect of body in HTML?

The &lt;body&gt;&lt;/body&gt; tag defines the body of an HTML document. Here is the minimum format needed for a basic HTML page. &lt;html&gt; &lt;head&gt; &lt;title&gt;Title&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Stuff goes here... &lt;/body&gt; &lt;/html&gt;


What is the effect in the body?

The &lt;body&gt;&lt;/body&gt; tag defines the body of an HTML document. Here is the minimum format needed for a basic HTML page. &lt;html&gt; &lt;head&gt; &lt;title&gt;Title&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Stuff goes here... &lt;/body&gt; &lt;/html&gt;


What is the head tag in HTML document?

The &lt;head&gt; at the beginning of an HTML document comes between &lt;html&gt; and &lt;body&gt;. It is a container that includes information that relates to the entire document. You can include the following tags in the &lt;head&gt; tag: &lt;title&gt; (required in an HTML document), &lt;style&gt;, &lt;base&gt;, &lt;link&gt;, &lt;meta&gt;, &lt;script&gt;, and &lt;noscript&gt;.


What is the difference between HTML head tag and body tag?

The &lt;HEAD&gt; tag is used to display the heading information like company name, page title etc in the web page The &lt;BODY&gt; tag is used to display the body of the web page - which contains all the contents you want to display


Different heading levels of an HTML document?

&lt;html&gt; &lt;head&gt; &lt;title&gt; &lt;body&gt;


What is HTML file for?

Basically, it tell a browser that what follow is written in the HTML markup language. This allows the browsetr to look for the relevant tags to properly display the context. Relevant tags are: &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;


What are the Two main parts of an HTML document?

Heading, denoted by the tages &lt;head&gt; &lt;/head&gt; and body denoted by &lt;body&gt; &lt;/body&gt;


What is basic HTML code?

Below is an example of a very basic webpage: &lt;html&gt; &lt;head&gt; &lt;title&gt;My First Webpage&lt;/title&gt; &lt;/head&gt; &lt;body bgcolor="yellow"&gt; &lt;p&gt;This is a yellow webpage&lt;/p&gt; &lt;/body&gt; &lt;/html&gt;