HTML

<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>


OIM3600
<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
flowchart TD A(document) --> B[html] B --> C[head] B --> D[body] C --> E[title] E --> F([Hello]) D --> G[h1] G --> H([Hello, world!])
OIM3600

Tags

OIM3600

Lists

  • Lists are useful for displaying information on a webpage, like:
    • Search results (e.g., Google Search)
    • Contacts (e.g., LinkedIn)
  • Unordered list: <ul>
  • Ordered list: <ol>
  • list item: <li> – Used to define each item within <ul> or <ol>.
OIM3600

Attributes

  • Attributes provide additional information for HTML elements and can be directly manipulated.
  • Common attributes include:
    • Links: <a href="URL"> – href specifies the destination.
    • Images: <img src="URL" alt="description">
      • src, alt, title, width, height
  • Additional Resources:
OIM3600

Form Basics

  • Forms allow websites to collect user information through input fields.
  • Common use cases include:
    • Search: Collects keywords for search functionality.
    • Registration: Gathers user details like name and email.
    • Submissions: Enables users to send information, such as feedback or uploads.
OIM3600

Form

  • Use the <form> tag to create a form.
  • Add input fields with the <input> tag to gather user information.
  • Each major form field has a corresponding type attribute, such as:
    • text, email, password, etc.
  • Usually end with an <input type="submit"> to add a submit button.
  • We’ll explore creating and handling forms using FastAPI/Flask and Python!
OIM3600

HTTP Request Methods

OIM3600

HTTP Request Method - GET

  • GET retrieves a representation of a specified resource.
  • In HTML forms, GET appends form data to the action URL as query parameters.
    • Useful for non-sensitive data and search functionality.
  • GET is the default method if no method attribute is specified in a form.
OIM3600

HTTP Request Method - POST

  • POST sends data to the server to be processed.
  • Commonly used for submitting form data that modifies or adds to server resources.
  • We’ll use POST to send data to our web application created with FastAPI/Flask and Python.
OIM3600

HTML Forms Selections

OIM3600

CSS

CSS Basics

  • Selectors: Define which HTML elements the styles will apply to.
    • Examples: element, .class, #id, [attribute]
  • Properties: Specify the styling rules for elements.
    • Examples: color, font-size, margin, padding
OIM3600
<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <!-- Inline CSS (quick, one-time styles; not recommended for production)-->
        <h1 style="color: #006644">Hello, world!</h1>
    </body>
</html>
OIM3600
<!DOCTYPE html>

<html lang="en">
    <head>
        <!-- Internal CSS (useful for unique, single-page styles) -->
        <style>
            h1 {
                color: #006644;
            }
        </style>
        <title>Hello</title> 
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
OIM3600
<!DOCTYPE html>

<html lang="en">
    <!-- External CSS linked from style.css (recommended for most projects) -->
    <link rel="stylesheet" href="style.css">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
OIM3600

CSS Frameworks & UI Components

OIM3600

JavaScript

Conditionals

OIM3600
if (x < y) {
    console.log("x is less than y");
} else {
    console.log("x is not less than y");
}
OIM3600

Variables

OIM3600
let counter = 0;
OIM3600
counter = counter + 1;

// or

counter += 1;

// or

counter ++;
OIM3600

Loop

OIM3600
let counter = 3

while(counter > 0){
    console.log("meow");
    counter = counter - 1;
}
OIM3600
for (let i = 0; i < 3; i += 1)
{
    console.log("meow");
}
OIM3600
// If you want to crash your Chrome

while (true){
    console.log("meow");
}
OIM3600

JavaScript DOM (Document Object Model)

<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
flowchart TD A(document) --> B[html] B --> C[head] B --> D[body] C --> E[title] E --> F([Hello]) D --> G[h1] G --> H([Hello, world!])
OIM3600

JavaScript DOM Events

blur
change
click
drag
focus
keyup
load
mousedown
mouseover
mouseup
submit
touchmove
unload
...
OIM3600
<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Hello</title>
        <!-- Link to external JavaScript file -->
        <script src="script.js" defer></script> 
        <!-- "defer" ensures the script loads after HTML parsing -->
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
OIM3600