Lesson with practice on HTML
To choose a different lesson from the course
Discussion
Theory lesson

2.1. Tags in HTML. Single and paired tags

From introductory lessons HTML you have already read that entire language consists of tags. In this lesson you will understand more with HTML tags. In HTML, there is a division of tags on a single (not paired) and paired tags. So, a single HTML tags consist of a single tag, that is, they have no closing tag. And paired descriptors have opening and closing tag.

Single HTML tags

Single tag does not have a closing tag. For example:<br>,<img>. Previously wrote:<br/>,<img/> now this style of writing a single tag is not relevant, so don't write so. The most used single tags:<br> - move to a new line,<hr> - the separation line,<img> - insert image.

Paired HTML tags

Paired much more. A pair of handle has an opening and closing tag. Pair tag forms a container. The contents of the container is what is between the opening and closing tag. In the example from this article did you see the tag<h1>What is the descriptors in HTML?</h1>now, this pair is the tag with the contents of this tag is the text "What is tags in HTML?". It is the beginning tag<h1>and the end</h1>.

The main problem for beginners in the writing of paired tags is confusion in the nesting. For example, here is the correct entry:<p><b> Fatty paragraph</b></p>. And here is the error:<p><b> Fatty paragraph</p></b>HTML document with such a layout is considered not valid. Not to be confused nesting, do this: create a pair of tags<p></p>, then put them in other<p><b></b></p>and at the end write the text inside the two tags<p><b>How to write paired tags</b></p>.

What's new in HTML5 in terms of tags?

HTML5 is an extension of HTML4, so it retains most or all of the descriptors from HTML4, and added its own. HTML5 adds special tags to split 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 sensitive to the layout of HTML documents, checking them for validity. Looking at them, the keywords are enclosed in a special descriptors and so on. But this topic is not about that. This refers to the promotion (SEO).

How to learn all the HTML tags?

ДYes, tags are not enough. But especially to teach them is not necessary. While you practice, you write something, you have all the handles, pair and single, easily remembered. Over time, of course.

<
×
>