Computers, Software
Structure of the HTML document: main tags, example
HTML is the language of the site markup. Many people consider it programming, but it's not. In HTML, there are no variables, calculations, arrays, or other elements present in any programming language.
Using HTML, the developer can create only the appearance of the site. It is important to understand that no site exists without markup. HTML is the base for creating web pages. The rest of the functionality is added by different programming languages.
Creating an html document
You can create a simple website page in any editor. Even "Notepad" will do. It is recommended for a novice developer to use other editors that have auto-substitution functions and other prompts. Thanks to this, you can create ready-made tables, links, images and other elements. And in "Notepad" each letter has to be written manually.
As a rule, "Notepad" is used only in cases where there are no other tools at hand. First, a text document is created, and then saved in html format. All pages on the site must have the html extension.
The html language is hierarchical. That is, there is a special structure for the html document. What it is? Let's consider below for clarity.
Structure of the html-document. Example
The structure is always the same. If you want to change something, the browser will not be able to process it. As a result, you will not get what you intended.
The figure above shows the structure of any html-file. The first item indicates the file type. This tag is specified once. If you use special editors, the whole structure will be created automatically. You will need to adjust the default values.
The structure of the html document is the main tags:
Of these three tags is the skeleton of the entire site. Pay attention to the picture. All these tags have a closing tag with a "/" character. If you are writing by hand, get used to putting both tags at once - opening and closing.
It was said above that the pages of the sites have the extension .html. That is, if you create a text document, but at the same time write the correct code, the browser will still display text just for you. There will be no code conversion.
Head section
In the figure below paragraph 3, the head section is indicated. This section indicates the service information. For example, you can specify the encoding (step 4) and the page title (step 5).
The title should always be. Without it, no search engine can determine the name of the content (text) on the web page. And this is bad for website promotion. Moreover, the browser at the top does not specify the title of the page. This is an inconvenience to the user.
The structure of the html-document is such that the title
In addition, head section specifies information for connecting scripts, style files, instructions for search engines or any other data that a user should not see, but they are important for the browser or programmers.
Connecting Styles
The structure of the html-document allows you to connect styles in various ways. Moreover, they can be written individually in each element. But this method is not recommended, because the code becomes too large and inconvenient.
Search engines recommend that all styles be rendered in a separate file, and in elements simply use different classes.
The file is connected as follows.
The href attribute specifies the path to the file. If there is an error in the path, the styles will not load. Also, the type attribute is required, which indicates that this is a css file.
Another option is to define styles directly in the head section.
But this option is also not very recommended. These methods are very different in that the css file can be one for the entire site, and all the changes in it will be instantly applied to all pages. And if you use the method shown in the figure above, then you will have to make changes to all existing pages of the site.
If the class you are creating will be used only on one page, then this option is right for you.
Connecting scripts
Scripts are connected as follows.