HTML is plain text file with .htm (html) extension. For creating the simplest page at first, when you are just training, you only need a notebook. Open notepad and write the text.
Each HTML element is a tag surrounded by<>brackets. Any file, html page starts with a tag and ends with the tag.
Here is the tag simply tells the browser (which is the program in which you browse the web) that this document is an html markup document.
Tag - means the beginning of the html document, and- closing tag, means the end of the html document.
Within these tags, there are several other important tags. Right after the tag there are tags meaning the page title and the body of the page.
Tag
Now you can create a new Text Document in notepad, copy the text above and save it as Page1.html and run it in the browser, you will see in the title of the browser window the title of the page from
So, the text above will be for us the basic frame of any web page.
Paired and unpaired tags!
,
, These are just paired tags - those tags that go as a pair of a tag and its closing, closing tag with the / symbol. For paired tags, the value contained between the beginning of the tag and its end is the tag's action. The action will propagate until a tag with the / character is found.Unpaired tags - they do not have a closing tag. Below we will give examples of such tags.
- header html pages, which includes keywords for search engines various scripts, etc. - Directly the body of the html document.
Unpaired tag.
Note: In most cases, now when building sites, they use ready-made routines, plugins, etc. – for more quick creation sites, but in order to apply and use such routines and templates, a minimum knowledge of these sessions is still required.
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. Typically, one tag only affects part of the document, such as 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, the horizontal bar tag
or image display tag
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
- empty elements — ,
,
,, - plain text elements —
- 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:
For example, I gave two completely different tags. The 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:
Figure 1. Structure of the html tag
Task for attentiveness and knowledge of HTML syntax
Let's look at an example of a simple web page that we looked at in the tutorial.
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 one 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 newline,
- the dividing line,
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
.Main mistake newbies to writing pair tags, this is a nesting confusion. 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 tagsHow 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.
Each 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: