What's the difference between HEAD tags and BODY tags?
most HTML books only 'briefly' mentions <head>
and <body>
tags...but they just go away really fast.
Do they affect how browsers render web pages?
Also, do they affect the order in which javascripts are run?
(I mean, if I have a javascript inside a <head>
tag, would it run BEFORE another javascript inside <body>
tag? Even when <body>
came BEFORE <head>
?)
This is too confusing--I haven't ever used a head/body tags, but i never had any trouble with it. But while reading Jquery tutorial, I saw people recommending putting some codes inside <head>
and the others inside <body>
tags.
Thank you!!!
The <body> tag defines the document's body. The <body> element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc. The <head> element is a container for all the head elements.
An HTML 4 document is composed of three parts: a line containing HTML version information, a declarative header section (delimited by the HEAD element), a body, which contains the document's actual content.
This tag contains the metadata about the webpage and the tags which are enclosed by head tag like <link>, <meta>, <style>, <script>, etc. are not displayed on the web page. Also, there can be only 1 <head> tag in the entire Html document and will always be before the <body> tag.
<head>: The Document Metadata (Header) element The <head> HTML element contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets.
Generally javascript code will function in the head before code in the body. The head section is usually used to contain information about the page that you dont neccessarily see like the meta keywords meta description or title of a page. You would also link to any external files like .css .js files in the head section as they need to load before the page is displayed.
Anything in the body section is what you would expect to be see on screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With