Open
Close

What is the difference between a single tag and a double tag? Paired tags. What's new in HTML5 in terms of tags

HTML (HyperText Markup Language) is a hypertext markup language. Markup language is used to give structure to an Internet page or website. The markup language does not carry design, but performs structuring tasks. The structure is set using special elements - labels that are understandable to the browser. These tags are called tags - from the English. words tag - named tag.

Hypertext is a document whose markup is made using the HTML language. The term “hypertext” was originally coined by Ted Nelson to refer to text “that branches out on itself or performs an action on demand.”

An HTML document is a regular text file that has a special structure. When opened, the Internet browser processes this document, as a result of which we see the Internet pages that are familiar to us, where there is text, pictures, links, etc. Internet pages have the extension – html.

Let's look at the structure of a simple HTML document

Document

Document

The string is called a tag. In general, everything that is enclosed in characters is called a tag. These symbols are service symbols in the HTML language. There are two types of tags:

  • Paired - these tags have an opening and a closing tag. The closing tag contains a slash character. The contents of the tag are written between these tags. The content of a tag can be either plain text or other nested tags. Examples of paired tags:
  • Unpaired - tags that are not closed. Example:

Tags can be written in capital or small letters, since HTML does not differentiate between spellings. You should always close paired tags!

It is considered good form to know and be able to operate with a large number of tags. There is no need to be afraid of this, everything will be remembered and fit into your head as soon as you begin to apply your knowledge in practice. We will become familiar with the main tags in the course of our further training. In general, a huge number of reference books on HTML are now available on the Internet, where you can find up-to-date information, because progress does not stand still, and programming languages ​​are developing rapidly and updates are coming out almost every six months. Also, you will find the minimum tags that we will need during the training in our cheat sheet

Let's look at the structure of the HTML document:
  • — what kind of tag is this? This is the version of HTML that is used on this page. It is customary to start all HTML documents with a similar tag. This is considered good manners. DOCTYPE tells the browser what version of HTML the document was written in, so that all browsers (and there are many of them now) can correctly process the markup and display the contents of the document. If this is not done, the default browser will incorrectly determine the version of the document, as a result of which all markup may move and display incorrectly in different browsers. In this case, DOCTYPE indicates the HTML5 version.
  • - all the content of the page is enclosed between these paired tags, which inform the browser that this is an HTML page.
  • -service section (header), which is used to connect external files and settings responsible for the appearance, output and operation of this page. Its content is most often not displayed on the page, except for the title tag. title tag – contains the title of the page, which is displayed in the tab.
  • — everything that is displayed on the page is written in the body tag.

To expand the functionality of HTML, special information called attributes is added to tags. So in the line:

charset="UTF-8" - attribute. There can be many attributes. Attributes are written separated by spaces. In this case, using the meta HTML tag, the UTF-8 encoding is indicated on the page. Those. The browser is told the encoding of this document to correctly display the contents of the page.

Attributes are used to extend the functionality of tags and allow you to modify both the way tags are displayed on a page and their behavior. Not all tags are used to display information; there are tags that are used only to program the behavior of the page, for example using JavaScript.

Questions for self-control
  • What is hypertext?
  • What is the need to use HTML?
  • What is page encoding? Why is it used? Where can you change the encoding in the browser?
  • What types of attributes do you know?
  • What are tags? How are they different from attributes?
  • What tags must an HTML page contain?
  • The text of the lesson was developed jointly with Kamenschik M.

    A tag is a special reserved word enclosed in angle brackets (for example, ). A tag is the main component of HTML: the code begins with it, it ends with it, and the information displayed on the web page is contained within the tags. It is recommended to write them in lowercase, that is, in ordinary small letters: not, but.

    What are the types of tags?

    Most HTML tags are paired: there is an opening tag (for example, ) and a closing tag, which is distinguished from the opening tag by a slash (/) after the first angle bracket (for example, ). Everything that is inside a pair of tags is called their content.

    Contents Text placed inside these tags becomes bold

    There are also unpaired (single) tags, which are called tags. They, unlike paired tags, do not need to be closed, because they do not work with the content, but perform some function on their own. Example of a single tag -
    . It sets the text to wrap to the next line.

    If we draw parallels with the Russian language, we can say that paired tags are quotes or brackets that affect the properties of the text contained in them (try not to close the quotes in time), and single tags (marks) are punctuation marks (exclamation, question or dot).

    Any tag consists of:

    • Open angle bracket (< ).
    • A special word (tag name). For example, hr , iframe , b .
    • Closing angle bracket (> ).
    Basic HTML Tags

    Since tags are the basis of markup language, it is not surprising that there are quite a lot of them. Let's look at the main, most important tags.