HTML Basics

0
727

So, now you have learned that all html documents consist directly of html elements. These elements can be nested into each other, thus forming the structure of the html document (the hierarchical tree of the html elements of the html document). Each html-element , with a few exceptions, must contain a start and end tag. Between these tags is the information part of the element itself, which is displayed by the web browser to the visitor of the web page. This is the complete syntax of the html element:

<tag_name [attribute_name = “Value” …]> … Information, other elements … </tag_name>

Html elements that do not have a trailing tag are described in a short form (these html elements do not have the information part and only specify the page layout):

<tag_name [attribute_name = “Value” …] />

All elements must necessarily contain (have) a trailing tag or be described in brief form (if available). This gives the source code of documents improved structuring and readability.

All HTML tags start with the left angle bracket (“<“) and end with the right angle bracket (“>”). A direct slash before the name of the trailing tag distinguishes it from the start tag. We must not forget that both tags are an integral part of each element. Take, for example, the title tag <title> tag that specifies the text of the document header (which is displayed in the header of the web browser window):

<title> document title </title>

In this particular case, <title> tells the web browser that the header description begins, and the closing </title> tag – that it is terminated.

It should also be taken into account that HTML ignores the case of characters that describe the tag. This example can look like this:

<Title> Document title </ titlE>

In addition, tabs, carriage returns, additional spaces that have been added (for its better readability) to the source of the HTML document, the WEB browser will ignore when displaying the document.
This does not apply to the <pre> tag . About him the conversation will go further.

It is recommended to describe all tags in lowercase.

Attributes of HTML elements

Some attributes carry additional information about the properties of most HTML elements. They are placed together with the opening tag. The value of each attribute follows it after the equal sign (=). If the attribute is not one, then the pairs: attribute_name = “Value” are separated by spaces, as in the example:

<table align = “center” border = “0”>

Here, the align attribute is the parameters for a certain alignment of the element, and border displays the thickness of its boundaries.

You should pay attention to double quotes, which are necessary to ensure that WEB-browsers correctly perceive attribute values.

Nesting of tags

Nested HTML tags are allowed. It is only necessary to remember that the embedded tag should start and end inside the parent tag. As in the example:

<p> We have published <b> <i> Quality Books </b> </i> Author name:-) </p>

So it would be wrong:

<p> We print <i> <b> Quality Books </b> Author nameĀ </p> </i>

I’ll remind you once again: you should strictly follow the nesting of tags. A nested tag must be terminated inside the parent tag (the same element) where it started directly.

Comments

HTML – like any similar programming language, it makes it possible to insert comments into the body of the document, they are saved when documents are transmitted over the network, but the WEB-browser does not display them.

Syntax of the comment:

<! – Comment ->

Comments can be as many as you like and they can be found anywhere in the document.