HTML - Body element


The en-US/docs/Web/HTML/Element/body element represents the body of a document (as opposed to the document’s metadata).

DOM Accessor

The document property document.body returns the body element. Can be set, to replace the body element.

The body element of a document is the first child of the html element that is:

  • either a body element
  • or a frameset element.

If there is no such element, it is null.

Why my body element is empty in the browser ?

In the browser, the HTML of the page is build as a DOM. Unfortunalty, if in the head, there is a empty script tag such as


browser such as chrome will not render the body and let it empty.

Discover More
CSS - Block Level (element|box)

Block-level refers to the (HTML) elements that are formatted visually as blocks. See for more information: Except for table boxes, and replaced elements, a block-level box can also be a block container...
CSS - Relative Sizing (Length)

Relative Sizing is when you are using a length units that is relative to another length property. Style sheets that use relative units will more easily scale from one medium to another (e.g., from a...
block directioninlinedirectionverticalwriting mode中文▼ left / block-end sideright / block-start side ▼top / inline-start side ▼bottom / inline-end side ▲width / block-sizeheight / inline-size
CSS - Flow

The flow is the direction of a block and inline layout against which the elements are positioned. This layout uses the concept of containing box as coordinate system. This containing box depends...
DOM - AppendChild

AppendChild is a node dom tree operation that: adds (a new node) move (a node of the DOM tree) as children at the end of all already existing children of this node. where: returnedValue is:...
DOM - Body

The body node in the DOM tree represents the HTML body element. You access the body node via the document node as property. Example: getComputedcomputed style value Document/body
HTML - (Document) Outline

This article talks: the extraction of the outline from a HTML document in order to create a HTML Table of Content The outline also known as the table of content is a list of one or more potentially...
HTML - (Flow|Body) Content

Most elements that are used in the body of documents and applications are categorized as flow content. Flow content consists of flow elements intermixed with normal character data. (ifbodhead...
HTML - CSS Style in Body (FOUC)

This article talks the Style element when it's located in the body element. It is accepted by browser but this is not the standard. The HMTL DTD does not allow it. But all browsers support it. Mainly...
HTML - Data attributes

Data (Key value) can be included for processing by a script using the data-=“” attributes. css attribute function Output: With an attribute selector, you can select the nodes with a certain...
HTML - Document

An HTML document is a well-formed HTML string (ie that contains the html root element). web page The HTML textual representation can be stored: in a string in a file or in the body of an HTTP...

Share this page:
Follow us:
Task Runner