Chapter 1: HTML and CSS – Exam Revision Notes

1. Introduction to HTML

  • HTML (HyperText Markup Language): Standard markup language for creating web pages.
  • Uses tags to define content and structure.
  • Web browsers interpret HTML to display pages.

1.1 HTML Document Structure

Basic HTML page layout:

<!DOCTYPE html>

<html>

  <head>

    <title>Page Title</title>

  </head>

  <body>

    Content goes here

  </body>

</html>

  • <html>: Root element
  • <head>: Metadata, title, links to CSS/JS
  • <body>: Visible content

1.2 HTML Tags

  • Document Tags: <html>, <head>, <body>
  • Structure Tags: <header>, <footer>, <section>, <article>
  • Formatting Tags:
    • Text-level: <b>, <i>, <u>, <em>, <strong>
    • Block-level: <p>, <div>, <h1>–<h6>
  • List Tags:
    • Ordered: <ol>
    • Unordered: <ul>
    • List item: <li>
  • Hyperlink Tags: <a href=”URL”>Link Text</a>
  • Executable Content Tags: <script>, <embed>, <object>

2. Images & Imagemaps

  • Images: <img src=”image.jpg” alt=”description”>
  • Imagemaps:
    • Client-side: <map> + <area>
    • Server-side: Handled by server scripts
    • Alternative text: alt attribute for accessibility

3. HTML Tables

  • Structure: <table>, <tr> (row), <td> (cell), <th> (header)
  • Attributes:
    • Alignment: align, valign
    • Width & Height: width, height
    • Border: border=”1″
    • Cell spacing & padding: cellspacing, cellpadding
  • Advanced:
    • Rowspan & Colspan: rowspan, colspan
    • Background color: bgcolor
  • Tables as design tools: Using tables for layout (deprecated in modern HTML)

4. HTML Frames

  • Frames split browser window into multiple sections
  • Tags:
    • <frameset>: Defines frames layout
    • <frame>: Loads content into a frame
    • <noframes>: Fallback content
  • Targeting frames: target attribute for links
  • Nesting framesets: Frames within frames

5. HTML Forms

  • Used to collect user input
  • attributes:
    • action: URL to submit data
    • method: GET or POST
  • Input elements:
    • Text: <input type=”text”>
    • Password: <input type=”password”>
    • File upload: <input type=”file”>
    • Radio button: <input type=”radio”>
    • Checkbox: <input type=”checkbox”>
    • Submit/reset buttons: <input type=”submit”>, <input type=”reset”>
    • Text area: <textarea>
    • Drop-down: <select><option>
  • Form events: onchange, onsubmit, onfocus, etc.
  • Labeling fields: <label for=”id”>Label Text</label>

6. Introduction to CSS

  • CSS (Cascading Style Sheets): Styles the visual presentation of HTML elements
  • Approaches:
    1. External CSS: <link rel=”stylesheet” href=”style.css”>
    2. Internal CSS: <style> within <head>
    3. Inline CSS: style attribute inside HTML tag

6.1 CSS Properties

  • Text formatting: color, font-family, font-size, text-align
  • Box model: margin, padding, border, width, height
  • Background: background-color, background-image
  • Positioning: position, top, left, right, bottom
  • Display: block, inline, inline-block, none

7. Key Takeaways

  • HTML defines structure and content of web pages
  • CSS defines visual style and layout
  • Forms collect user input, tables display structured data, frames divide browser view
  • Imagemaps allow interactive images
  • Proper combination of HTML + CSS ensures accessible, responsive, and attractive web pages

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.