What tags can only be in Body?

What tags can only be in Body?

Every html page has several required components. One of these is the tag. . It depends on its correct design what the user will see in the browser window. We tell you what the tag body is and how it should be used.

What is Body in HTML

The body tag is designed to store all the useful information that is available to the user and displayed in the browser window. Two things depend on the correct design of this element:

  • correct display of all content on the web page - text, images, links, animations, scripts, banners, etc.;
  • successful web page ranking in search engines.

Body is one of the main site creation tags along with head. Without them, it is impossible to create a debugged web resource. What is the head tag for? It is used to store technical information that helps the browser to work with the data. Almost everything contained in head tag, is not shown to the user.

When to Use the Body Tag

In the HTML5 specification, body refers to optional elements. Despite this, it continues to be used for two reasons:

  • convenient separation of user and technical information;
  • usefulness of the tag when creating styles in a CSS file.

In an html document, there is always only one body - this is an axiom. The opening and closing tags are optional. 

Deciding where to put the body tag? Follow the main rule - place the tag immediately after the closing .

Body structure tags

body tag may have different attributes. Some of them should be used with caution due to conflict with the html specification. Let's consider in more detail what parameters the body tag can have:

  • bgcolor, to define the background color of the page;
  • text, sets the color of the text on the page;
  • alink, active link color;
  • vlink, sets the color of visited links;
  • scroll if you want to display a scrollbar.
Do not miss:  Creativity on the edge of technology: How to use modern tools for inspiration

Also in the tag you can place generic attributes and events. So don't be surprised to see class, dir, style, onload, onreset or others there.

At the same time, one should not forget that in meta tags should not be used, as this will invalidate the code and may break the markup of the web page. Placing incorrect attributes may prevent users from opening the web resource. Therefore, they will go to the network to look for the answer to the question “how to open a site that does not open”, not even suspecting that the problem is not on their part.

To prevent such incidents from happening, layout designers and coders of html pages should be careful. And, of course, to have up-to-date knowledge. The Hillel Computer School will help with the latter. They have specialized courses that are taught by mentors with vast experience. During the training, you will repeatedly consolidate all the knowledge gained in practice, which is much more effective.

Based on: https://itwiki.dev/ru/

5/5 - (1 votes)
Translate »