Tags Used in <head> Section
The <head> section of an HTML document contains multiple tags for different purposes and contributes to the overall functionality and presentation of the web page.
List of Tags Used in <head> Section
- <title>: Sets the title of the web page, which appears in the browser's title bar or tab.
- <meta>: Provides metadata about the HTML document, such as character encoding, author, description, keywords, etc.
- <link>: Used to link external resources to the HTML document, such as stylesheets (CSS files), icon files (favicon), or other linked resources.
- <style>: As mentioned earlier, it contains CSS style rules that define how elements in the HTML document should be displayed.
- <script>: Used to include JavaScript code in the head section, though it's more common to include scripts at the end of the body section to improve page loading performance.
- <base>: Specifies the base URL for relative URLs within the document.
- <noscript>: Allows you to provide alternate content to be displayed if the user's browser doesn't support JavaScript or if the user has disabled JavaScript.
- <meta viewport>: Used to control the viewport behavior on mobile devices, ensuring that the page scales appropriately.
Syntax Example of <head> Tags
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="My awesome website">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
</body>
</html>