Components of a web page: Difference between revisions

From Computer Science Wiki
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:


[[file:Connection.png|right|frame|Web Science<ref>http://www.flaticon.com/</ref>]]
[[file:Connection.png|right|frame|Web Science<ref>http://www.flaticon.com/</ref>]]


= Components of a Web Page =
= Components of a Web Page =


A web page is composed of various components that work together to display content in a structured and interactive way. These components can be broadly categorized into the **head**, **body**, and **optional external resources**.
A web page is composed of various components that work together to display content in a structured and interactive way. These components can be broadly categorized into the head, body, and optional external resources.


== 1. Document Structure ==
== 1. Document Structure ==
* **HTML Tag (`<html>`):**
* HTML Tag:
   * The root element that encompasses the entire web page.
   * The root element that encompasses the entire web page.
   * Specifies the language of the document using the `lang` attribute (e.g., `<html lang="en">`).
   * Specifies the language of the document using the `lang` attribute (e.g., `lang="en"`).


== 2. Head Section (`<head>`) ==
== 2. Head Section ==
Contains metadata and resources needed for the web page but not directly visible to users.
Contains metadata and resources needed for the web page but not directly visible to users.


=== Meta Tags (`<meta>`) ===
=== Meta Tags ===
* Provide metadata about the document.
* Provide metadata about the document.
* Examples:
* Examples:
   * **Charset:** Specifies the character encoding (e.g., `<meta charset="UTF-8">`).
   * Charset: Specifies the character encoding (e.g., `UTF-8`).
   * **Viewport:** Controls the page's layout on different devices (e.g., `<meta name="viewport" content="width=device-width, initial-scale=1.0">`).
   * Viewport: Controls the page's layout on different devices (e.g., `width=device-width, initial-scale=1.0`).
   * **Description:** Brief summary of the page (e.g., `<meta name="description" content="This is a sample webpage.">`).
   * Description: Brief summary of the page (e.g., "This is a sample webpage.").


=== Title Tag (`<title>`) ===
=== Title Tag ===
* Defines the title of the document displayed in the browser tab or search engine results.
* Defines the title of the document displayed in the browser tab or search engine results.
* Example: `<title>My Sample Page</title>`.
* Example: "My Sample Page".


=== Link Tags (`<link>`) ===
=== Link Tags ===
* Used to link external resources like CSS stylesheets or icons.
* Used to link external resources like CSS stylesheets or icons.
* Example: `<link rel="stylesheet" href="styles.css">`.
* Example: Stylesheet linking or favicon specification.


=== Script Tags (`<script>`) ===
=== Script Tags ===
* Include or link external JavaScript files.
* Include or link external JavaScript files.
* Example: `<script src="script.js"></script>`.
* Example: External or inline JavaScript.


=== Favicons ===
=== Favicons ===
* Specify the website's icon displayed in the browser tab.
* Specify the website's icon displayed in the browser tab.
* Example: `<link rel="icon" href="favicon.ico" type="image/x-icon">`.
* Example: Reference to a favicon file.


== 3. Body Section (`<body>`) ==
== 3. Body Section ==
The visible part of the web page, containing the main content and interactive elements.
The visible part of the web page, containing the main content and interactive elements.


=== Content Structure ===
=== Content Structure ===
* **Headers (`<h1>` to `<h6>`):**
* Headers:
   * Define headings, with `<h1>` being the most important and `<h6>` the least important.
   * Define headings, with different levels of importance.
* **Paragraphs (`<p>`):**
* Paragraphs:
   * Used for blocks of text.
   * Used for blocks of text.
* **Lists:**
* Lists:
   * **Ordered List (`<ol>`):** Displays numbered items.
   * Ordered List: Displays numbered items.
   * **Unordered List (`<ul>`):** Displays bulleted items.
   * Unordered List: Displays bulleted items.
   * **List Items (`<li>`):** Items within a list.
   * List Items: Items within a list.
* **Links (`<a>`):**
* Links:
   * Hyperlinks to other pages or resources.
   * Hyperlinks to other pages or resources.
  * Example: `<a href="https://example.com">Visit Example</a>`.
* Images:
* **Images (`<img>`):**
   * Embeds images into the content.
   * Embeds images.
  * Example: `<img src="image.jpg" alt="Sample Image">`.


=== Interactive Elements ===
=== Interactive Elements ===
* **Forms (`<form>`):**
* Forms:
   * Collect user input with fields like text boxes and buttons.
   * Collect user input with fields like text boxes and buttons.
   * Example:
   * Example: Simple forms with text input and submit button.
    ```
    <form action="/submit" method="POST">
      <input type="text" name="username" placeholder="Enter username">
      <button type="submit">Submit</button>
    </form>
```
 


* **Buttons (`<button>`):**
* Buttons:
   * Trigger actions or scripts.
   * Trigger actions or scripts.


== 4. External Resources ==
== 4. External Resources ==
* **CSS (Cascading Style Sheets):**
* CSS (Cascading Style Sheets):
   * Control the visual styling of the page.
   * Control the visual styling of the page.
  * Linked via `<link>` tags or embedded within `<style>` tags.
* JavaScript:
 
* **JavaScript:**
   * Adds interactivity and dynamic behavior.
   * Adds interactivity and dynamic behavior.
  * Linked via `<script>` tags or written inline.
* External Libraries or APIs:
 
   * Include frameworks like Bootstrap or external JavaScript APIs.
* **External Libraries or APIs:**
   * Include frameworks like Bootstrap or external JavaScript APIs like Google Maps.


== 5. Closing Tags ==
== 5. Closing Tags ==
* Ensure all open tags are closed properly to maintain valid HTML structure.
* Ensure all open tags are closed properly to maintain valid HTML structure.
* Example:
  * `<html>`, `<head>`, and `<body>` tags must all be closed.
```
```
== Do you understand this? ==
== Do you understand this? ==
From the IB: To include features such as meta- tags, title, etc.
From the IB: To include features such as meta- tags, title, etc.

Latest revision as of 14:23, 25 November 2024


Web Science[1]


Components of a Web Page[edit]

A web page is composed of various components that work together to display content in a structured and interactive way. These components can be broadly categorized into the head, body, and optional external resources.

1. Document Structure[edit]

  • HTML Tag:
 * The root element that encompasses the entire web page.
 * Specifies the language of the document using the `lang` attribute (e.g., `lang="en"`).

2. Head Section[edit]

Contains metadata and resources needed for the web page but not directly visible to users.

Meta Tags[edit]

  • Provide metadata about the document.
  • Examples:
 * Charset: Specifies the character encoding (e.g., `UTF-8`).
 * Viewport: Controls the page's layout on different devices (e.g., `width=device-width, initial-scale=1.0`).
 * Description: Brief summary of the page (e.g., "This is a sample webpage.").

Title Tag[edit]

  • Defines the title of the document displayed in the browser tab or search engine results.
  • Example: "My Sample Page".

Link Tags[edit]

  • Used to link external resources like CSS stylesheets or icons.
  • Example: Stylesheet linking or favicon specification.

Script Tags[edit]

  • Include or link external JavaScript files.
  • Example: External or inline JavaScript.

Favicons[edit]

  • Specify the website's icon displayed in the browser tab.
  • Example: Reference to a favicon file.

3. Body Section[edit]

The visible part of the web page, containing the main content and interactive elements.

Content Structure[edit]

  • Headers:
 * Define headings, with different levels of importance.
  • Paragraphs:
 * Used for blocks of text.
  • Lists:
 * Ordered List: Displays numbered items.
 * Unordered List: Displays bulleted items.
 * List Items: Items within a list.
  • Links:
 * Hyperlinks to other pages or resources.
  • Images:
 * Embeds images into the content.

Interactive Elements[edit]

  • Forms:
 * Collect user input with fields like text boxes and buttons.
 * Example: Simple forms with text input and submit button.
  • Buttons:
 * Trigger actions or scripts.

4. External Resources[edit]

  • CSS (Cascading Style Sheets):
 * Control the visual styling of the page.
  • JavaScript:
 * Adds interactivity and dynamic behavior.
  • External Libraries or APIs:
 * Include frameworks like Bootstrap or external JavaScript APIs.

5. Closing Tags[edit]

  • Ensure all open tags are closed properly to maintain valid HTML structure.

```

Do you understand this?[edit]

From the IB: To include features such as meta- tags, title, etc.

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[2]

  • Outline the different components of a web page.

References[edit]

  1. http://www.flaticon.com/
  2. IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.