The tag deserves a separate lesson because, although its content is not displayed on the screen, it plays a fundamental role in creating a web page.
As we have already mentioned, this tag contains the information concerning the site, but what kind of information does it enclose? First of all, it contains the title of the site, which is not a small thing. Then it contains the description of the site and the keywords that characterize the site itself.
The title, description, and keywords are fundamental for a good position on Search Engines, but we will see this later. In addition to what has been said, it contains personal information of the webmaster such as the e-mail address, the name, and any copyright. It might hold many other informations, but not necessary for the purposes of site development, so let’s limit ourselves to these.
Each element has its own reference Tag without which the Browser will be unable to recognize it as such. So we will have Tags related to text, Tags related to images, Tags related to colors, Tags related to positioning… and so on.
Before making friends with some important Tags, it is good to see what a Tag is made of:. A Tag is enclosed between two angle brackets without which it would not be interpreted by the Browser. Another important consideration is thateach opening Tag must always obligatorily correspond to a closing Tag without which the Browser would be unable to translate the document.
The closing Tags, compared to the opening ones, have in addition only a small slash like this /. Here is how a closing Tag looks: . Here is the exact syntax command of Tags: command content…. Now that we have started to get familiar with Tags, let’s see some of the most used ones:
These are some of the most commonly used Tags and in the following lessons, we will see how to use them and become familiar with other important Tags.
Like all other tags, to be valid it must have an opening tag and a closing tag so, for the title tag we have: tag Having said that, open the online editor and add this new tag among those in head by inserting as title My first site:
Save the page as index.html and open it with your web browser. Look at the top left, in the first upper bar of the browser, and you will see the title of your site printed in that bar itself. Now, let’s add a short description to our title, in order to complete its reference:
Save the page again as index.html overwriting the previously saved one to validate the changes.
The Body tag encloses everything you see on your screen, so all the viewable elements of a web page. Text, images, videos, forms, links, and much more are included in this very important tag. To give a small example of what the Body tag represents, let’s take our index.html page again and write the following between the Body tags:
Save the page again accepting the changes and load it in your web browser. See? This is the meaning of the Body tag, without which any web page would appear as a desolate white sheet.
Pubblicato in HTML & CSS
Be the first to comment