HTML/CSS Lesson 9 – HEAD Section in HTML and SEO

Last updated on December 17th, 2023

What is SEO?

SEO stands for Search Engine Optimization. SEO is a set of practices aimed at improving the visibility and ranking of a website in search engine results. In simpler terms, it’s about making your website more “search engine-friendly” so that people can find it easily when they search for relevant topics on search engines like Google, Bing, or Yahoo.

Which elements of the HEAD section are related to SEO?

SEO consists of many elements and methods that will not be covered in this lesson. But several elements of the HEAD section of the HTML page are related to SEO – these are the Page Title and the Page Description.

The <head> section in an HTML page contains so called meta-information about the document. It doesn’t display any content on the web page itself but provides essential details for browsers and search engines.

From the previous lessons, you already know that the HEAD section contains the title tag (<title>).

The <title> tag defines the title of the HTML document – the most important information about the content of the page. The title in the HEAD section appears in the browser’s title bar or tab and is crucial for search engine optimization (SEO). It helps users identify the content of the page when multiple tabs are open and serves as the default name for bookmarking. So it is highly recommended to have a <title> tag in the HEAD section and it should contain important keywords describing the content of the page.

There is also another important element that is located in the HEAD section and is related to SEO – this is the description of the page, which is placed in the description meta tag. The syntax of the description meta tag is as follows:

<meta name=”description” content=”Short description of the page.”>
(The description meta tag has no closing tag.)

The description in HEAD section of an HTML page provides a brief summary of the page’s content. It is often used by search engines to display a snippet of information about the page in search results. A well-crafted description can attract users to click on your page in search results, improving click-through rates.

How long should the page title and description be?

It is recommended to keep the page title approximately 20 to 50 characters long and the page description 30 to 80 characters long.

The importance of the h1 tag for SEO

From an SEO perspective, it’s also a good idea to repeat your main keywords in the most important HTML title tag <h1> on the top of your page. The h1 tag helps Google and other search engines better understand what your page is about. It is recommended to use only one h1 tag per page.

Example:

Let’s say you’re making a page about free HTML tutorials for beginners. In this case, it is recommended to put the following title and description in the HEAD section of your page and in the h1 tag in the BODY section of the page:

<!DOCTYPE html>
<html>
<head>

<title>Free HTML Tutorials for Beginners</title>
<meta name="description" content="Free HTML tutorials for beginners. Learn the basics of HTML for free.">

</head>
<body>

<h1>Free HTML Tutorials for Beginners</h1>

Some content about the HTML language.

</body>
</html>