Web Basics and Design Principles
Introduction to Web: What is Web, Protocols and programs, Secure
connections, application and development tools, the web browser, What is
server, Types of Web Servers, Setting up UNIX and Linux web servers,
Logging users, dynamic IP.
Web Design: Web site design principles, planning the site and navigation.
Introduction to Web
What is the Web?
The web, also known as the World Wide Web (WWW), is a vast collection of interconnected documents
and other resources linked through hyperlinks and URLs, accessible via the internet. It allows users to
navigate, share, and consume digital information. It operates over the internet using a client-server
model, where web browsers (clients) request resources from web servers.
Protocols and Programs
HTTP (Hypertext Transfer Protocol): The foundational protocol used for transmitting web
pages over the internet. It governs the communication between clients (browsers) and servers.
HTTPS (Hypertext Transfer Protocol Secure): An extension of HTTP with encryption via SSL/TLS,
ensuring secure communication between users and servers.
FTP (File Transfer Protocol): A protocol for transferring files from one computer to another over
the web, often used for uploading files to a web server.
Web Development Programs: Tools and programs for web development include HTML, CSS,
JavaScript (frontend), and PHP, Python, Ruby, and Node.js (backend), along with database
systems like MySQL and MongoDB.
Secure Connections
SSL (Secure Sockets Layer) and TLS (Transport Layer Security): These protocols provide
encryption for web traffic, ensuring secure data exchange between client and server, especially
during sensitive transactions like online shopping and banking.
Application and Development Tools
Integrated Development Environments (IDEs): Tools like Visual Studio Code, Sublime Text, and
Atom, which offer syntax highlighting, code completion, and debugging for web development.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/20
Frameworks: Tools like React, Angular (frontend), Django, Flask, and Laravel (backend) that
simplify web development by providing pre-built components and patterns.
The Web Browser
A web browser is a software application that retrieves and displays web pages from the internet.
Popular browsers include Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge. They interpret
HTML, CSS, and JavaScript to render web pages for users.
What is a Server?
A server is a system that provides resources, data, or services to clients over the internet. It hosts
websites, manages requests, and responds to client inquiries. Servers are critical in the client-server
architecture of the web.
Types of Web Servers
1. Apache HTTP Server: Open-source and highly popular web server software.
2. Nginx: A high-performance, open-source web server used for serving static content, reverse
proxying, and load balancing.
3. Microsoft IIS (Internet Information Services): A web server software for Windows-based
servers.
4. LiteSpeed: Known for its speed and efficiency, especially with PHP-based applications.
Setting Up UNIX and Linux Web Servers
1. Install Web Server Software: Install Apache or Nginx using package managers like `apt` or
`yum` in UNIX/Linux systems.
2. Configure Server Settings: Modify the server configuration file (e.g.,
`/etc/apache2/apache2.conf` for Apache).
3. Launch and Test the Server: Start the server and verify using IP or domain.
4. Security: Implement SSL certificates for HTTPS, configure firewalls, and set up secure user
permissions.
Logging Users
Web servers maintain logs of user activity, including IP addresses, visited pages, timestamps, and
browser details. Logs can be managed using log files like `access.log` and `error.log` in Apache.
Dynamic IP
A dynamic IP address is an IP address that changes periodically, typically assigned by DHCP (Dynamic
Host Configuration Protocol). It is commonly used by ISPs to provide temporary IP addresses to users.
Web Design
Web Site Design Principles
User-Centric Design: Prioritize user needs and experiences in the design process.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 2/20
Responsive Design: Create websites that adapt to different devices and screen sizes (e.g.,
mobile, tablet, desktop).
Consistency: Maintain a consistent layout, typography, and style throughout the website.
Accessibility: Ensure the website is accessible to users with disabilities by following web
standards such as WCAG.
Planning the Site and Navigation
Define Objectives: Identify the purpose of the site and the target audience.
Site Map: Create a structure of the website’s pages and their relationships.
Wireframes and Prototypes: Develop basic layouts and interactive models of the website to
map user journeys.
Navigation Design: Ensure intuitive and clear navigation to guide users easily through the site.
By understanding these fundamentals, you can grasp the essential aspects of web development and
design needed for creating user-friendly, functional websites.
Introduction to HTML:HTML Basics, Elements, Attributes, Comments,
Formatting, Links, Images, Tables, Lists, Block, Frames, HTML Meta Tags,
HTML Forms, Form Elements, Various Input Elements.
HTML 5: Introduction to HTML5, New Elements, HTML5 Semantics,
Storage API, Location API, Migration to HTML5.
Introduction to HTML
HTML (Hypertext Markup Language) is the standard language used to create and design web
pages. It structures content on the web, using elements and tags to define text, links, images, forms,
and other elements of a webpage.
HTML Basics
HTML Structure:
html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
DOCTYPE: Defines the document type and version of HTML (e.g., HTML5).
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 3/20
html, head, body tags: The basic structure of an HTML document, with content placed
inside the `<body>`.
Elements and Attributes
HTML Elements: Building blocks of HTML, typically consisting of a start tag, content, and an end
tag.
Example: `<p>This is a paragraph.</p>`
Attributes: Provide additional information about HTML elements. Attributes are defined in the
opening tag.
Example: `<img src="image.jpg" alt="An image" width="500">`
`src`, `alt`, and `width` are attributes of the `<img>` tag.
Comments
HTML comments are added to code to describe its purpose or to hide elements. They are not visible
on the webpage.
html
<!-- This is a comment -->
Formatting
HTML provides tags to format text:
Bold: `<b>` or `<strong>`
Italic: `<i>` or `<em>`
Underline: `<u>`
Strikethrough: `<s>`
Subscript and Superscript: `<sub>`, `<sup>`
Links
Links allow navigation between different web pages or external resources using the `<a>` (anchor)
tag.
html
<a href="https://www.example.com">Visit Example</a>
href attribute defines the URL the link points to.
Images
Images are inserted using the `<img>` tag with the `src` attribute to define the image location and the
`alt` attribute for alternative text.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 4/20
html
<img src="image.jpg" alt="A beautiful image" width="300">
Tables
Tables structure tabular data using the following tags: `<table>`, `<tr>` (table row), `<th>` (table
header), and `<td>` (table data).
html
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>25</td>
</tr>
</table>
Lists
Ordered Lists (numbered): Use the `<ol>` tag.
html
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Unordered Lists (bulleted): Use the `<ul>` tag.
html
<ul>
<li>Item one</li>
<li>Item two</li>
</ul>
Block Elements
Block elements take up the full width available and create a break before and after the element.
Examples: `<div>`, `<p>`, `<h1>`, `<table>`, `<ul>`
Frames
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 5/20
Frames allow dividing the browser window into multiple sections, each loading a different HTML
document using the `<frame>` tag (deprecated in HTML5).
html
<frameset cols="50%,50%">
<frame src="page1.html">
<frame src="page2.html">
</frameset>
HTML Meta Tags
Meta tags provide metadata about the HTML document (e.g., description, keywords, author). They are
placed inside the `<head>` section.
html
<meta name="description" content="A description of the webpage">
<meta name="keywords" content="HTML, CSS, JavaScript">
HTML Forms
Forms collect user input and send it to the server for processing.
html
<form action="/submit" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<input type="submit" value="Submit">
</form>
Form Elements
Text input: `<input type="text">`
Password: `<input type="password">`
Submit button: `<input type="submit">`
Radio button: `<input type="radio">`
Checkbox: `<input type="checkbox">`
Textarea: `<textarea></textarea>`
Various Input Elements
HTML supports a wide range of input types:
Text: `<input type="text">`
Number: `<input type="number">`
Email: `<input type="email">`
Date: `<input type="date">`
File: `<input type="file">`
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 6/20
HTML5
HTML5 is the latest version of HTML and introduces new elements and APIs for modern web
development. It emphasizes improved multimedia support, semantic elements, and interactivity
without relying on external plugins like Flash.
New Elements in HTML5
Semantic Elements:
`<header>`, `<footer>`, `<article>`, `<section>`, `<nav>`, `<aside>` — These provide better
document structure and meaning.
Multimedia Support:
`<video>` and `<audio>` elements for embedding media directly into web pages.
html
<video controls>
<source src="movie.mp4" type="video/mp4">
</video>
Canvas: Allows dynamic, scriptable rendering of 2D shapes and graphics.
html
<canvas id="myCanvas"></canvas>
HTML5 Semantics
HTML5 introduces semantic elements to give meaning to web page structure, enhancing both
accessibility and SEO.
`<article>`: Represents an independent piece of content.
`<section>`: Represents a section within a document.
`<nav>`: Defines navigation links.
`<aside>`: Represents content related to the main content.
Storage API
LocalStorage: Allows the storage of key-value pairs in the browser without expiration.
javascript
localStorage.setItem("key", "value");
let value = localStorage.getItem("key");
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 7/20
SessionStorage: Stores data for the duration of the page session.
Location API
HTML5 provides the Geolocation API to get the user’s geographic location.
javascript
navigator.geolocation.getCurrentPosition(function(position) {
console.log("Latitude: " + position.coords.latitude);
console.log("Longitude: " + position.coords.longitude);
});
Migration to HTML5
Migrating from older versions of HTML to HTML5 involves updating document structure and
elements. Ensure to:
Replace deprecated elements (like `<center>`, `<font>`) with CSS alternatives.
Use semantic elements.
Adopt modern input types and APIs (e.g., `<video>`, localStorage).
This introduction covers the fundamental aspects of HTML and HTML5, from basic structure to
advanced capabilities.
Cascading Style Sheets:Introduction, Basic Syntax, Colors, backgrounds,
Border, Margin, Padding, Height, Width, BOX Model, Other basic style
elements. Layouts, Positions, Forms, Pseudo class, and elements, 2D and 3D
transitions, Animations, CSS grids, Responsiveness.
CSS 3.0:Rounded Corners, Border Images, Multi background, Multi
columns, Shadow, Gradients, Web Fonts, Media Types.
Cascading Style Sheets (CSS)
CSS (Cascading Style Sheets) is a style sheet language used to control the presentation and layout of
HTML documents. It allows for the separation of content (HTML) and design (CSS), providing
consistency and flexibility in styling web pages.
Introduction to CSS
CSS defines how HTML elements should be displayed. It enables you to style elements by setting
properties like color, size, positioning, layout, and more. Styles can be applied directly within an HTML
element (inline), within a `<style>` tag (internal), or through an external CSS file (external).
Inline CSS Example:
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 8/20
html
<p style="color: blue;">This text is blue.</p>
Internal CSS Example:
html
<style>
p { color: blue; }
</style>
External CSS Example:
html
<link rel="stylesheet" href="styles.css">
Basic Syntax
The basic syntax of CSS consists of a selector, property, and value.
css
selector {
property: value;
}
Selector: Identifies the HTML element(s) to style (e.g., `h1`, `.class`, `#id`).
Property: The style aspect to change (e.g., `color`, `font-size`).
Value: The desired appearance (e.g., `blue`, `16px`).
Colors
CSS allows you to specify colors using:
Named colors: `color: red;`
Hexadecimal values: `color: #ff0000;`
RGB values: `color: rgb(255, 0, 0);`
HSL values: `color: hsl(0, 100%, 50%);`
Backgrounds
The `background` property sets the background color or image of an element.
Background color: `background-color: yellow;`
Background image: `background-image: url('image.jpg');`
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 9/20
Background repeat, position, and size: Controls how the background is displayed.
Border, Margin, and Padding
Border: Defines the border around an element.
css
border: 2px solid black;
Margin: Defines the space outside an element.
css
margin: 10px;
Padding: Defines the space inside an element, between the content and border.
css
padding: 20px;
Height and Width
The `height` and `width` properties specify the dimensions of an element.
css
height: 100px;
width: 200px;
Box Model
The CSS Box Model describes how the padding, border, and margin of an element affect its overall
size and position.
Content: The text or image inside the box.
Padding: Space between the content and the border.
Border: The border around the padding (optional).
Margin: The space outside the border.
Layouts and Positioning
CSS offers different ways to position elements:
Static: Default positioning (elements appear in normal document flow).
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 10/20
css
position: static;
Relative: Positioned relative to its normal position.
css
position: relative;
Absolute: Positioned relative to the nearest positioned ancestor.
css
position: absolute;
Fixed: Positioned relative to the browser window.
css
position: fixed;
Flexbox and Grid: Modern layout systems for responsive and flexible layouts.
Forms
CSS can style form elements (e.g., input fields, buttons) by adjusting properties like `width`, `padding`,
and `border`.
css
input {
width: 300px;
padding: 10px;
border: 1px solid gray;
}
Pseudo-Classes and Elements
Pseudo-Classes: Apply styles to elements in a specific state (e.g., `:hover`, `:active`, `:focus`).
css
a:hover { color: red; }
Pseudo-Elements: Style specific parts of an element (e.g., `::before`, `::after`).
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 11/20
css
p::before { content: "Note: "; color: red; }
2D and 3D Transitions
Transitions: Smoothly animate changes to properties.
css
div {
transition: background-color 0.5s ease;
}
div:hover {
background-color: blue;
}
Transforms (2D and 3D): Move, scale, rotate, or skew elements.
css
div {
transform: rotate(45deg); /* 2D rotation */
transform: rotate3d(1, 1, 0, 45deg); /* 3D rotation */
}
Animations
CSS animations allow the creation of complex, keyframe-based animations.
css
@keyframes myAnimation {
from { opacity: 0; }
to { opacity: 1; }
}
div {
animation: myAnimation 2s infinite;
}
CSS Grid
The CSS Grid layout system is a two-dimensional grid-based system, making it easy to design
responsive layouts.
css
.grid-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 12/20
gap: 10px;
}
Responsiveness
CSS media queries allow the design to adapt to different screen sizes and devices, ensuring that
websites are mobile-friendly.
css
@media (max-width: 600px) {
body { background-color: lightblue; }
}
CSS 3.0
CSS3 introduced many new features to enhance the capabilities of CSS.
Rounded Corners
The `border-radius` property creates rounded corners for elements.
css
border-radius: 10px;
Border Images
The `border-image` property allows the use of an image as a border.
css
border-image: url('border.png') 30 30 stretch;
Multi-backgrounds
CSS3 allows multiple backgrounds to be applied to an element.
css
background-image: url('bg1.jpg'), url('bg2.jpg');
background-position: left top, right bottom;
Multi-columns
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 13/20
The multi-column layout in CSS3 makes it easy to flow text across multiple columns.
css
column-count: 3;
column-gap: 20px;
Shadows
Box-shadow: Adds shadow to elements.
css
box-shadow: 10px 10px 5px gray;
Text-shadow: Adds shadow to text.
css
text-shadow: 2px 2px 5px black;
Gradients
CSS3 supports both linear and radial gradients without the need for images.
Linear gradient:
css
background: linear-gradient(to right, red, yellow);
Radial gradient:
css
background: radial-gradient(circle, red, yellow, green);
Web Fonts
CSS3 introduced support for custom web fonts via the `@font-face` rule.
css
@font-face {
font-family: 'MyFont';
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 14/20
src: url('myfont.woff');
}
body {
font-family: 'MyFont', sans-serif;
}
Media Types
CSS3 supports various media types like screen, print, and handheld devices to apply styles based on
the output medium.
css
@media print {
body {
font-size: 12pt;
}
}
This overview of CSS and CSS3 covers the key concepts, properties, and features that are essential for
building modern, responsive, and visually appealing websites.
JavaScript: Introduction to Client-Side Scripting, Purpose of JavaScript,
Basic Syntax, Variables, Operators, Loops, Functions, Arrays, Array
Methods, Strings, String Methods, Regular Expression, HTML Form
Validation, Debugging and Best Practices.
JavaScript: Introduction to Client-Side Scripting
JavaScript is a lightweight, interpreted programming language primarily used for adding interactivity
and dynamic features to web pages. It runs directly in the browser on the client side, allowing for the
creation of responsive, interactive user experiences without needing server interaction.
Purpose of JavaScript
JavaScript enhances web pages by:
Manipulating the DOM (Document Object Model) for dynamic content.
Handling events (clicks, keypresses, etc.).
Validating forms before submission.
Making asynchronous requests (e.g., via AJAX or Fetch).
Animating elements and controlling multimedia.
Basic Syntax
JavaScript syntax refers to the set of rules for writing code. It includes:
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 15/20
Statements: Individual instructions that perform an action.
javascript
console.log("Hello, World!");
Case Sensitivity: JavaScript is case-sensitive, meaning `myVar` and `myvar` are different.
Semicolons: Semicolons are optional but recommended to terminate statements.
Variables
Variables store data that can be used and manipulated in JavaScript. There are three ways to declare
variables:
var: Function-scoped or globally scoped.
let: Block-scoped and preferred over `var` in modern JavaScript.
const: Block-scoped, but the value cannot be reassigned.
javascript
var name = "Alice";
let age = 25;
const pi = 3.1416;
Operators
Operators perform operations on variables and values. Some common operators are:
Arithmetic Operators: `+`, `-`, `*`, `/`, `%`
javascript
let sum = 5 + 10; // sum = 15
Assignment Operators: `=`, `+=`, `-=`, etc.
javascript
let x = 10;
x += 5; // x = 15
Comparison Operators: `==`, `===`, `!=`, `!==`, `<`, `>`, `<=`, `>=`
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 16/20
javascript
if (x === 15) { console.log("x is 15"); }
Logical Operators: `&&` (and), `||` (or), `!` (not)
javascript
if (x > 10 && x < 20) { console.log("x is between 10 and 20"); }
Loops
Loops allow for repeating blocks of code multiple times.
for loop:
javascript
for (let i = 0; i < 5; i++) {
console.log(i);
}
while loop:
javascript
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
do-while loop:
javascript
let i = 0;
do {
console.log(i);
i++;
} while (i < 5);
Functions
Functions are blocks of code designed to perform a specific task and can be reused.
Function Declaration:
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 17/20
javascript
function greet(name) {
console.log("Hello, " + name);
}
greet("Alice"); // Output: Hello, Alice
Arrow Functions (ES6+):
javascript
const greet = (name) => {
console.log("Hello, " + name);
};
greet("Bob");
Arrays
Arrays are used to store multiple values in a single variable.
javascript
let colors = ["red", "green", "blue"];
console.log(colors[0]); // Output: red
Array Methods
JavaScript provides several built-in methods to manipulate arrays:
push(): Adds an item to the end of an array.
javascript
colors.push("yellow");
pop(): Removes the last item from an array.
javascript
colors.pop();
shift(): Removes the first element from an array.
unshift(): Adds elements to the beginning of an array.
forEach(): Executes a function for each element in an array.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 18/20
javascript
colors.forEach(function(color) {
console.log(color);
});
Strings
Strings are sequences of characters used to store and manipulate text.
javascript
let message = "Hello, World!";
console.log(message.length); // Output: 13
String Methods
JavaScript offers various string manipulation methods:
charAt(): Returns the character at a specific index.
javascript
console.log(message.charAt(0)); // Output: H
slice(): Extracts a section of a string.
javascript
console.log(message.slice(0, 5)); // Output: Hello
toUpperCase(): Converts the string to uppercase.
toLowerCase(): Converts the string to lowercase.
split(): Splits the string into an array based on a delimiter.
javascript
let words = message.split(", "); // ["Hello", "World!"]
Regular Expressions
Regular expressions are patterns used for matching character combinations in strings.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 19/20
javascript
let pattern = /[A-Za-z]+/;
let result = pattern.test("Hello123"); // true
HTML Form Validation
JavaScript is often used to validate HTML forms before they are submitted to a server.
javascript
function validateForm() {
let name = document.forms["myForm"]["name"].value;
if (name == "") {
alert("Name must be filled out");
return false;
}
}
HTML form validation can check if required fields are filled, if an email is valid, or if the input matches
a specific pattern using regular expressions.
Debugging and Best Practices
Console Logging: `console.log()` helps you output values and check the flow of the script
during debugging.
javascript
console.log("This is a log message.");
Debugging Tools: Most modern browsers (like Chrome, Firefox) have built-in developer tools
that allow you to set breakpoints, view variables, and step through code line by line.
Best Practices:
Use `let` and `const` instead of `var` to avoid scope issues.
Always use strict equality (`===`) instead of loose equality (`==`).
Write modular functions for better readability and reusability.
Comment your code to describe logic and complex sections.
Use consistent naming conventions (e.g., camelCase for variables and functions).
This introduction to JavaScript outlines essential concepts and practices for client-side scripting, from
basic syntax and operations to advanced topics like form validation and debugging techniques.
ChatGPT can make mistakes. Check important info.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 20/20