Module 1: HTML Formatting
What is HTML Formatting?
HTML contains several tags for defining text with a special meaning.
<b>and<strong>define bold text.<i>and<em>define italicized text.<u>defines underlined text.<h1>to<h6>define HTML headings.<p>defines a paragraph, and<br>inserts a single line break.<hr>creates a horizontal line across the page.
Legacy Tags & Colors
Older versions of HTML allowed direct styling without CSS using attributes:
bgcolor="..."andtext="..."on the<body>tag set background and text colors.<font color="..." size="..." face="...">sets the font properties for text.<marquee>creates scrolling text, and<blink>(now deprecated in many browsers) creates flashing text.
Test Yourself
1. Which tag is used for the largest heading?
Module 2: Lists, Links & Images
HTML Lists
HTML allows web developers to group a set of related items in lists.
- Unordered HTML List: Starts with the
<ul>tag. Each list item starts with the<li>tag. The list items will be marked with bullets. You can change the bullet type using thetypeattribute (e.g.,type="circle"). - Ordered HTML List: Starts with the
<ol>tag. Each list item starts with the<li>tag. The list items will be marked with numbers or letters based on thetypeattribute (e.g.,type="I"for Roman numerals).
HTML Links and Images
Links are the defining feature of the web because they allow you to move from one page to another.
- The
<a>tag defines a hyperlink. The most important attribute ishref, which indicates the link's destination. - Links can point to external websites (
href="https://...") or to specific parts of the same page (internal linking) by pointing to an id (href="#top"). - The
<img>tag is used to embed an image in an HTML page. It is empty, contains attributes only, and does not have a closing tag. Thesrcattribute specifies the path to the image, andaltspecifies an alternate text.
Test Yourself
1. Which attribute specifies an alternate text for an image?
Module 3: Tables & Layouts
HTML Tables
HTML tables allow web developers to arrange data into rows and columns.
- A table in HTML consists of table cells inside rows and columns.
- The
<table>tag defines the table. - Each table row is defined with a
<tr>tag. - Each table header is defined with a
<th>tag. By default, the text in<th>elements are bold and centered. - Each table data/cell is defined with a
<td>tag.
Merging Cells
You can make a cell span across multiple rows or columns to create complex grid layouts:
colspanmakes a cell stretch horizontally across columns.rowspanmakes a cell stretch vertically across rows.
Test Yourself
1. Which attribute spans a cell over multiple rows?
Module 4: Forms & User Input
HTML Forms
The <form> element is used to create an HTML form for user input. A form is a container for different types of input elements, such as text fields, checkboxes, radio buttons, submit buttons, etc.
Form Elements
<input type="text">defines a single-line text input field.<input type="password">defines a password field where characters are masked.<input type="radio">defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices. Groups of radio buttons must share the samenameattribute.<input type="checkbox">defines a checkbox. Checkboxes let a user select ZERO or MORE options.<select>defines a drop-down list. The<option>tags define the available options in the list.<textarea>defines a multi-line input field (a text area).
Test Yourself
1. Which input type allows selecting multiple options?
Module 5: Frames Layout
What are Frames?
Frames allow a web browser window to be divided into separate segments, each of which can show a different HTML document. This was a common way to build navigation menus in the early days of the web.
- Traditionally, the
<frameset>tag replaced the<body>tag. Thecolsattribute split the screen vertically, and therowsattribute split it horizontally. - Inside a frameset, you use the
<frame>tag to specify which HTML file should load in that area, assigning it aname. - To make links open in a specific frame, you use the
target="..."attribute on the<a>tag, pointing it to the name of the frame you want to update.
Note: Because traditional framesets break out of modern web elements, the example below simulates frames safely using standard <iframe> tags and standard tables to demonstrate the exact same linking mechanics!
Test Yourself
1. What attribute connects an anchor tag's link to a specific frame?
Module 6: Mini Multi-Page Website
Requirement: Create a website of 6–7 pages with different effects as mentioned in the syllabus.
How to accomplish this
To create a connected multi-page website, you simply create multiple HTML files in the same folder on your computer and link them together using the anchor tag (<a href="filename.html">).
Your folder structure would look like this:
index.html(Homepage / Main Menu)page1.html(Formatting Examples)page2.html(Lists and Links)page3.html(Complex Tables)page4.html(User Registration Forms)page5.html(Student Grades Table)page6.html(Frames Layout)
Module 7: JavaScript Practical Algorithms
JavaScript can interact with the user via popup boxes like alert() for output and prompt() for input. We also use for and while loops to repeat actions, and if/else conditionals to make decisions.
Task 1: Numbers 5 to 15 Table
Goal: Print a table of numbers from 5 to 15 along with their squares and cubes.
Concept: We use a for loop to iterate from 5 to 15. The \n character is used to create a new line in the alert box string.
Task 2: Largest of Three Numbers
Goal: Print the largest of three numbers provided by the user.
Concept: We use prompt() to get user input, and parseFloat() to convert that input text into a number. Then, we use if statements to check which number is the highest.
Task 3: Factorial of a Number (n!)
Goal: Find the factorial of a number n.
Concept: The factorial of a number (like 5!) is 5 x 4 x 3 x 2 x 1. We use a for loop to multiply a running total by each number up to n.
Task 4: Sum and Average
Goal: Enter a list of positive numbers terminated by Zero. Find the sum and average.
Concept: A while(true) loop runs infinitely until the user enters 0, at which point the break statement stops the loop. We keep track of the sum and the count of numbers entered to calculate the average.
Task 5: Compound Interest
Goal: Compute the amount in an account yielding 5% interest on Rs 1000 at the end of each year for n years.
Concept: The formula for compound interest is A = P(1 + r)^t. In JavaScript, exponents are calculated using Math.pow(base, exponent).
Task 6: Count Positives, Negatives, Zeros
Goal: Read n numbers. Count the number of negative numbers, positive numbers, and zeros.
Concept: We loop exactly n times. Inside the loop, we use an if / else if / else chain to check if the number is greater than 0, less than 0, or exactly 0, and increment the respective counter.
Test Yourself
1. Which method is used to ask the user for input?