A container for the following components in HTML is the <head> element: <title>, <style>, <meta>, <link>, <script>, and <base>.
The HTML < head > Element
Positioned between the <html> and <body> tags, the <head> element serves as a container for metadata, or information about data.
Data about the HTML document is called HTML metadata. There is no display of metadata.
Character sets, styles, scripts, document titles, and other meta information are often defined via metadata.
The HTML < title > Element
The document’s title is defined by the <title> element. The title appears in the tab on the website or in the title bar of the browser and has to be text only.
HTML publications must contain the <title> element!
A page title’s content has a big impact on search engine optimization (SEO)! Search engine algorithms use the page title to determine which pages to display in search results.
The <title>element:
describes a toolbar title in the browser.
gives the page a title when it is added to favorites.
gives the page’s title in search engine results.
Thus, make an effort to be as precise and meaningful as you can with the title!
A basic HTML document
Example
There Is a Good Page Title
The content of the document......
The HTML < style > Element
For a single HTML page, style information is defined using the <style> element:
Example
The HTML < link > Element
The connection between the current document and an external resource is specified by the <link> element.
When linking to external style sheets, the <link> tag is most frequently used:
Example
The HTML < meta > Element
Typically, the character set, page description, keywords, document author, and viewport parameters are specified using the <meta> element.
The metadata is utilized by search engines (keywords), browsers (how to display content or reload pages), and other web services; it is not visible on the page.
Example
Define the character set used:
Define keywords for search engines:
Define a description of your web page:
Define the author of a page:
Refresh document every 30 seconds:
Example of <meta> tags:
Example
Setting The Viewport
A web page’s visible region to the user is called the viewport. It depends on the device; for example, it will be smaller on a computer screen than it is on a mobile phone.
Every web page you create should have the following <meta> element:
This gives the browser instructions on how to control the page’s dimensions and scaling.
The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.
Here is an example of a web page without the viewport meta tag, and the same web page with the viewport meta tag: