Metadata
Metadata in HTML
Metadata in HTML provides information about a webpage, such as its description, character set, keywords, and viewport settings. Metadata elements are placed inside the <head>
section of an HTML document and help search engines, browsers, and social media platforms understand the page better.
The <meta>
Element
- The
<meta>
tag is self-closing and does not display content on the page. - It provides essential information like character encoding, author, and page description.
Character Encoding (<charset>
)
- Defines the character set for the document.
<meta charset="UTF-8">
description
) Page Description (
- Helps search engines display a short summary in search results.
<meta name="description" content="Learn the best HTML metadata practices.">
keywords
) Keywords for SEO (
- Specifies keywords related to the page.
<meta name="keywords" content="HTML, metadata, SEO, web development">
author
) Author Information (
- Defines the page author.
<meta name="author" content="John Doe">
viewport
) Viewport Settings for Mobile (
- Ensures responsive design by setting the viewport width and zoom level.
Example:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Refresh or Redirect (http-equiv
)
- Automatically refreshes or redirects the page.
<meta http-equiv="refresh" content="5">
Conclusion
Metadata in HTML enhances webpage functionality, SEO, and responsiveness. Proper use of <meta>
tags ensures better search rankings, accessibility, and user experience.
<textarea>
The HTML <textarea> element generates a multi-line input field for users to enter text, providing a flexible space for longer input. It includes attributes such as rows, columns, and placeholder text to enhance user experience.
<!DOCTYPE>
The <!DOCTYPE> declaration defines the document type and version of HTML, ensuring the browser renders the page correctly.