Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What content can be outside head and body tags?

Tags:

html

xhtml

This may seem like a weird question, but i'm building some script that reads HTML files and i'm dividing the content to 2, body and head and was wondering if there could be other content i might not know of?

The only thing i know of is <DOCTYPE> and i was wondering if there could be more?

like image 377
eric.itzhak Avatar asked Nov 20 '12 10:11

eric.itzhak


People also ask

What are head and body tags?

Definition and UsageThe <head> element is a container for metadata (data about data) and is placed between the <html> tag and the <body> tag. Metadata is data about the HTML document. Metadata is not displayed. Metadata typically define the document title, character set, styles, scripts, and other meta information.

Can I put footer outside body?

Since the footer is a visible piece of your site, it should go within the body.

What are the head and body tags used for in an HTML document?

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.

Should footer be inside or outside body?

The <footer> tag in HTML is used to define a footer of HTML document. This section contains the footer information (author information, copyright information, carriers, etc). The footer tag is used within the body tag.


1 Answers

The doctype declaration isn't exactly content in the sense of the word.

There isn't any content that is supposed to exist outside head and body (and in fact, any content that's meant to display should only exist inside body). Browsers can create some pretty wacky DOMs when you give them strange or invalid markup, however. Here's an example.

Also, head and body, in that order, are the only two possible children of html, the root element.

like image 185
BoltClock Avatar answered Sep 20 '22 05:09

BoltClock