Tags are paired and unpaired. The concept of the HTML tag

Tag (pl. tags, sometimes tag) is an element HTML language, which is used to mark up the source text of a web page. Tags are abbreviations or abbreviations of English words enclosed in angle brackets.<>eg tag

abbreviation for the English word paragraph, that is, the text enclosed in this tag will be recognized by browsers as a paragraph.

Each tag in HTML has a special meaning and is responsible for displaying certain data. The case of letters in tag names does not matter, for example, tag

and tag

- This is the same. That is, tags can be written both lowercase and capital letters. Previously, it was generally accepted that all tags be written in capital letters so that the tags differ from regular text. Now this is not necessary, since many editors have syntax highlighting.

Tag classification

There are more than 90 tags in HTML. As a rule, one tag affects only part of the document, for example, the first level heading tag

. In such cases, paired tags are used: opening And closing. Opening tag (for example,

) creates the effect, and the closing (

) terminates it. As you can see from the example, the closing tag always has this character ( / ) is a forward slash. These tags are called paired.

Some tags have a one-time effect where they appear. For example, tag horizontal bar


or image display tag . Such tags do not have end tags. Such tags are called not paired.

Tag types

In addition, tags are divided into several types, which differ in their functions:

  • document title tags;
  • block elements;
  • inline elements;
  • universal elements;
  • lists;
  • tables;
  • frames.

This division is not strict, so some tags are in different groups. For example, tags for creating lists

    And
      apply to both lists and block elements.

      Tag structure

      When loaded in a browser, the tags themselves are not displayed, but they affect how their content is displayed. If a tag is misspelled, it is ignored in its entirety.

      All tags have a certain structure that must be observed when writing. In addition, almost all tags have various attributes that can change the way content is displayed.

      Let's look at the correct structure of tags containing attributes:

      1. Himself Webmaster

      For example, I gave two completely different tags. First single - responsible for displaying images, attribute - src="logo.jpg". Second the pair is responsible for creating links, the attribute is href="site".

      Conclusion 1: Attributes can have paired and unpaired tags.

      Conclusion 2: Attributes can only have start tags, end tags have no attributes.

      Picture for clarification:

      You have already read that the entire language is made up of tags. In this tutorial, we'll take a closer look at HTML tags. In the HTML language, tags are divided into single (not paired) and paired tags. So, single HTML tags consist of a single tag, that is, they do not have a closing tag. And paired descriptors have an opening and closing tag.

      Single HTML tags

      Single tags do not have a closing tag. For example:
      , . It used to be written like this:
      , , now this style of writing single tags is not relevant, so don't write like that. Most used single tags:
      - transfer to new line,


      - the dividing line, - insert image.

      Paired HTML tags

      Paired tags a lot more. The pair descriptor has an opening and closing tag. The pair tag forms a container. The content of the container is what is between the opening and closing tag. In the example from this article, you saw the tag

      What are tags in HTML?

      , so, this is a pair tag, the content of this tag is the text "What are tags in HTML?". Its beginning is the tag

      , and the end

      .

      The main mistake of beginners in writing paired tags is confusion in nesting. For example, this is the correct entry:

      Bold paragraph

      . And here is the error:

      Bold paragraph

      , an HTML document with such layout is not considered valid. In order not to confuse nesting, do this: create paired tags, then put others in them, and at the end write text inside both tags

      How to write pair tags correctly

      .

      What's new in HTML5 in terms of tags?

      HTML5 language is an extension of HTML4, so it kept most or all of the tags from HTML4 and added its own. HTML5 introduced special tags to break the site into main blocks: header, menu, footer, sidebar and content.

      Why is it important to learn how to use tags?

      Search engines Yandex and Google are sensitive to layout HTML documents checking them for validity. They look for keywords enclosed in special descriptors and so on. But this section is not about that. This applies to promotion (SEO).

      How to learn all HTML tags?

      Yes, there are a lot of tags. But there is no need to specifically teach them. While you practice writing something, all the descriptors, paired and single, will be easy to remember. Over time, of course.

      HTML tags is the basis of the HTML language. Tags are used to delimit the start and end of elements in markup.

      Every HTML document consists of a tree of HTML elements and text. Each HTML element is identified by a start (opening) and an end (closing) tag. The start and end tags contain the tag name.

      All HTML elements are divided into five types:

      • empty elements , ,
        , , ,
        , , ,
        Used to store additional information about the page. This information is used by browsers to process the page, and search engines to index it. In the block there may be multiple tags , because depending on the attributes used, they carry different information. Measurement indicator in the specified range.