Course Content
HTML Forms
HTML forms are an essential part of web development and provide a way for users to input and submit data to a server. Forms allow users to enter data such as text, numbers, checkboxes, radio buttons, and more. When a user submits a form, the data is typically sent to a server for further processing.
0/6
HTML Graphics
HTML provides various ways to incorporate graphics into web pages.
0/2
HTML Media
HTML provides built-in support for embedding and displaying various types of media content on web pages.
0/5
HTML APIs
HTML APIs, also known as browser APIs or web APIs, are a set of interfaces and methods provided by web browsers to interact with and manipulate web content, access device features, and perform various tasks. These APIs are implemented in JavaScript and are accessible to web developers when creating web applications. Here are some commonly used HTML APIs:
0/5
HTML Examples
Creating a Simple Web Page, Adding Links and Images and more
0/4
HTML5 for Free | HTML5 – Unleashing the Potential of Web Development
About Lesson

The favicon, short for “favorite icon,” is a small image that represents a website or web page and is displayed in the browser’s tab, bookmarks, and other areas. It helps users easily identify and distinguish between different websites. In HTML, you can set the favicon for your web page by adding a <link> tag within the <head> section. Here’s how you can add a favicon to your HTML page:

  1. Create or Find the Favicon Image:
    First, you need to create or find an image that you want to use as the favicon. The image should typically be square and have a size of 16×16 pixels or 32×32 pixels. Common file formats for favicons are .ico, .png, and .gif.
  2. Add the Favicon Link Tag:
    Within the <head> section of your HTML document, add a <link> tag with the following attributes:
  • rel="icon": Specifies the relationship of the linked file as an icon.
  • type="image/ico": Specifies the MIME type of the favicon image. For .ico files, use “image/ico”. For other image formats, use the corresponding MIME type, such as “image/png” or “image/gif”.
  • href="path/to/favicon.ico": Specifies the path or URL of the favicon image file.

Example:

<head>
  <link rel="icon" type="image/ico" href="path/to/favicon.ico">
</head>

Replace "path/to/favicon.ico" with the actual path or URL of your favicon image file.

  1. Place the Favicon in the Root Directory:
    To ensure the browser can find the favicon image, make sure to place the favicon image file in the root directory of your website or specify the correct path in the href attribute.
  2. Test the Favicon:
    Save your HTML file and open it in a web browser. If everything is set up correctly, you should see the favicon displayed in the browser’s tab, bookmarks, or other relevant areas.

It’s worth noting that different browsers may have different requirements and support for favicon formats. It’s recommended to provide multiple favicon formats to maximize compatibility across different browsers and devices. You can create and include additional favicon formats by adding more <link> tags with different type attributes, each pointing to a specific favicon file format.

Additionally, you can also specify a larger version of the favicon for high-resolution displays by using the rel="icon" attribute with the sizes attribute.

Example:

<link rel="icon" type="image/png" href="path/to/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="path/to/favicon-16x16.png" sizes="16x16">

In this example, the favicon is provided in both 32×32 and 16×16 pixel sizes as PNG images.

Including a favicon enhances the visual identity and branding of your website. It’s a small but significant detail that contributes to a professional and polished web presence.

Join the conversation