Discovering semantic elements in HTML5
Posted: Sun Jan 05, 2025 9:17 am
As I mentioned earlier, the two tags have completely different semantic and logical purposes.
The first one mainly contains code for the functioning of the page because, being at the top, it is the first one that is processed by the browser. It is important to understand this behavior from now because for all web pages the code is processed starting from the top to the bottom and it is a very important detail present in most programming languages.
As previously mentioned, in addition to <title>the tag <head>it can contain references to CSS or JavaScript files and other tags <meta>that can be used by search engines or social networks.
If you have heard about Facebook's Open Graph, you will have understood that they allow you to saudi arabia phone number data provide this social network with information relating to the article that is shared on your social network, information such as the featured image, the title, the description and other small details. To do this, you use the <meta> element enriched with some particular attributes.
Inside the tag <head>you can also host other useful elements both for SEO and for inserting references to RSS Feeds that allow the visitor to subscribe to blog updates, but it will be better to talk about these topics another time.
Let's now move on to the tag <body>which can contain a huge number of tags starting from the new semantic elements such as <header>, <nav>, <audio>and <video>introduced in HTML5, but also the classic <div>or <p>.
Each of these tags has a specific name due to its function and also has specific properties that allow it to behave differently within our pages.
One very important thing to understand before we go any further is that if you put a tag that goes in <body>inside of it <head> will not work while, some tags like CSS or JavaScript references will work even if placed in <body>. This is because <head>it was designed only to contain the information of the page while the <body>is the space that shows what it contains.
The first one mainly contains code for the functioning of the page because, being at the top, it is the first one that is processed by the browser. It is important to understand this behavior from now because for all web pages the code is processed starting from the top to the bottom and it is a very important detail present in most programming languages.
As previously mentioned, in addition to <title>the tag <head>it can contain references to CSS or JavaScript files and other tags <meta>that can be used by search engines or social networks.
If you have heard about Facebook's Open Graph, you will have understood that they allow you to saudi arabia phone number data provide this social network with information relating to the article that is shared on your social network, information such as the featured image, the title, the description and other small details. To do this, you use the <meta> element enriched with some particular attributes.
Inside the tag <head>you can also host other useful elements both for SEO and for inserting references to RSS Feeds that allow the visitor to subscribe to blog updates, but it will be better to talk about these topics another time.
Let's now move on to the tag <body>which can contain a huge number of tags starting from the new semantic elements such as <header>, <nav>, <audio>and <video>introduced in HTML5, but also the classic <div>or <p>.
Each of these tags has a specific name due to its function and also has specific properties that allow it to behave differently within our pages.
One very important thing to understand before we go any further is that if you put a tag that goes in <body>inside of it <head> will not work while, some tags like CSS or JavaScript references will work even if placed in <body>. This is because <head>it was designed only to contain the information of the page while the <body>is the space that shows what it contains.