Friday, March 29, 2024

Tags in head tag

☝✨✨✨✨✨✨✨✨✨✨✨✨✨

Tags commonly included within the <head> section of an HTML document are used for metadata, linking external resources, and specifying document information. Here are some examples:

  1. Metadata Tags:

    • <title>: Sets the title of the HTML document.
    • <meta>: Specifies metadata about the HTML document (e.g., character set, viewport settings, etc.).
  2. Link Tags:

    • <link>: Links external resources such as stylesheets (CSS) or icons.
    • <script>: Links external JavaScript files or embeds JavaScript code directly.
  3. Other Tags:

    • <style>: Defines internal styles within the HTML document.
    • <base>: Specifies the base URL and target for all relative URLs in the document.
    • <noscript>: Provides fallback content for users who have disabled scripts in their browser.

Here is an example of how these tags can be used within the <head> section of an HTML document:


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Website</title> <link rel="stylesheet" href="styles.css"> <script src="script.js"></script> <style> /* Internal styles */ body { font-family: Arial, sans-serif; } </style> <base href="https://www.example.com/" target="_blank"> </head> <body> <!-- Body content goes here --> </body> </html>

In this example:

  • The <meta> tags define the character set and viewport settings.
  • The <title> tag sets the title of the document.
  • The <link> tag links an external stylesheet (styles.css).
  • The <script> tag links an external JavaScript file (script.js) and includes internal styles using the and includes internal styles using the <style> tag.
    • The <base> tag specifies the base URL and target for relative URL.

No comments:

Post a Comment

Class: X Session: 2023-24 Computer Applications (Code 165) Sample Question Paper (Theory)

Check the Link of Sample Question Paper  https://drive.google.com/file/d/1Do3jskK-Ipt380Jl1XW1EpwlMVeQG41R/view?usp=drive_link https://drive...