Foundations of Computing From Hardware Essentials to Web Design
Foundations of Computing From Hardware Essentials to Web Design
Understanding the web content delivery, Understanding HTML and XHTML Connections,
Understanding Cascading Style Sheets, Understanding JavaScript
N
1. What is Web Design?
O
Web design is the process of creating and designing websites that are visually appealing,
user-friendly, and functional. It includes three main technologies:
I
AT
1. HTML (HyperText Markup Language) → Provides the structure of a webpage.
2. CSS (Cascading Style Sheets) → Styles and designs the webpage.
3. JavaScript → Adds interactivity and dynamic behavior.
C
A good web design ensures a smooth user experience, fast performance, and responsiveness
across different devices.
U
ED
Web Design Best Practices
✔ Keep it simple and clean → Avoid clutter.
✔ Use readable fonts and colors → Ensure good contrast.
✔ Make it mobile-friendly → Use responsive design.
E
Web content delivery is the process of serving web pages and multimedia content to users via
the internet.
BE
N
5. CDN (Content Delivery Network): A network of distributed servers that deliver web
content faster.
O
○ Example: Cloudflare, Akamai, AWS CloudFront.
○ YouTube uses CDNs to load videos faster from servers closer to the user.
I
AT
2. HTML & XHTML Connections
HTML (HyperText Markup Language)
C
U
HTML is used to create the structure of web pages using tags.
ED
<!DOCTYPE html>
E
<html>
IV
<head>
EH
</head>
BE
<body>
<h1>Welcome to My Website</h1>
</body>
</html>
XHTML is a stricter and cleaner version of HTML that follows XML rules.
N
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
O
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
I
<html xmlns="http://www.w3.org/1999/xhtml">
AT
<head>
C
<title>XHTML Example</title>
</head>
U
ED
<body>
<h1>XHTML Page</h1>
</body>
EH
</html>
BE
Key Differences Between HTML & XHTML
N
I O
AT
C
U
● Web Content Delivery ensures fast and secure webpage loading using servers,
ED
browsers, HTTP/HTTPS, DNS, and CDNs.
● HTML is the standard language for creating webpages, while XHTML follows stricter
syntax for better compatibility and structure.
E
IV
1. What is HTML?
BE
HTML (HyperText Markup Language) is the foundation of web development, used to create
and structure webpages. It consists of elements (tags) that define content like headings,
paragraphs, images, and links.
💡 Key Features:
✔ Defines the structure of a webpage.
✔ Uses tags enclosed in angle brackets (< >).
✔ Works with CSS for styling and JavaScript for interactivity.
2. Basic HTML Structure
Every HTML document follows a basic structure:
<!DOCTYPE html>
<html lang="en">
N
<head>
O
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
I
initial-scale=1.0">
AT
<title>My First Web Page</title>
</head>
<body>
C
<h1>Hello, World!</h1>
<p>Welcome to my first webpage.</p>
</body>
U
ED
</html>
Explanation of Tags:
E
Tag Description
IV
tab).
<h1>Main Heading</h1>
<h2>Subheading</h2>
N
<h3>Smaller Heading</h3>
O
● <h1> is the largest, <h6> is the smallest.
I
AT
Paragraphs and Line Breaks
C
<p>This is a paragraph.</p>
<p>This is another paragraph.</p> U
<br>
<p>Line break above!</p>
ED
Images (<img>)
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
N
</ul>
O
🔹 Displays items with bullet points.
I
AT
Ordered List (<ol>)
C
<ol>
<li>Step 1</li> U
<li>Step 2</li>
<li>Step 3</li>
ED
</ol>
Tables (<table>)
IV
<table border="1">
EH
<tr>
<th>Name</th>
<th>Age</th>
BE
</tr>
<tr>
<td>Alice</td>
<td>22</td>
</tr>
<tr>
<td>Bob</td>
<td>25</td>
</tr>
</table>
Name Age
Alice 22
Bob 25
N
● <tr> → Table row.
● <th> → Table header (bold).
O
● <td> → Table data (normal cell).
I
AT
4. Forms (User Input)
C
Forms allow users to enter data, such as login details.
<form>
U
ED
<label for="name">Name:</label>
<input type="text" id="name" placeholder="Enter your name">
<label for="email">Email:</label>
<input type="email" id="email" placeholder="Enter your email">
E
IV
<label for="password">Password:</label>
<input type="password" id="password">
EH
5. HTML Comments
N
<!-- This is a comment -->
<p>This is visible text.</p>
O
✔ Comments help explain the code but are not visible on the webpage.
I
AT
6. HTML Attributes
C
Attributes add extra information to elements.
U
ED
<a href="https://example.com" target="_blank">Open in New Tab</a>
N
I O
AT
🎯 HTML provides the basic structure of a webpage.
C
🎯 It works with CSS (for design) and JavaScript (for interactivity).
U
🎯 Practice by creating simple webpages!
ED
1. What is CSS?
IV
CSS (Cascading Style Sheets) is used to style HTML elements, making webpages look
attractive and user-friendly. It controls the colors, fonts, layouts, spacing, and animations
EH
of a webpage.
N
🔹 Cons: Not reusable, difficult to maintain.
O
2️⃣ Internal CSS (Inside <style> in <head>)
I
AT
Defined within the <style> tag in the HTML document.
C
<!DOCTYPE html>
<html> U
<head>
<style>
ED
body {
background-color: lightgray;
}
h1 {
E
color: red;
}
IV
</style>
</head>
EH
<body>
<h1>Red Heading</h1>
</body>
BE
</html>
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
h1 {
color: blue;
N
text-align: center;
}
OI
Step 2: Link CSS in HTML
AT
<link rel="stylesheet" href="styles.css">
C
🔹 Pros: Reusable across multiple pages.
🔹 Cons: Needs an extra file. U
ED
3. CSS Selectors
CSS selectors target HTML elements and apply styles.
E
IV
* {
margin: 0;
BE
padding: 0;
}
N
3️⃣ Class Selector (.)
O
Targets elements with a specific class.
I
AT
.special-text {
color: purple;
font-weight: bold;
C
}
💡 Usage in HTML:
U
ED
#main-title {
font-size: 30px;
color: darkblue;
BE
💡 Usage in HTML:
<h1 id="main-title">Main Title</h1>
5️⃣ Grouping Selector
h1, h2, p {
color: navy;
}
N
O
4. CSS Properties & Examples
I
AT
1️⃣ Colors
Named Colors:
p {
C
color: red;
U
ED
}
h1 {
color: #ff5733;
IV
}
EH
RGB Colors:
BE
body {
background-color: rgb(240, 240, 240);
}
body {
background-color: lightblue;
background-image: url("background.jpg");
background-size: cover;
background-position: center;
}
N
O
p {
font-family: Arial, sans-serif;
I
font-size: 18px;
AT
font-weight: bold;
text-align: center;
text-decoration: underline;
C
text-transform: uppercase;
}
U
ED
.box {
width: 300px;
EH
height: 200px;
background-color: lightgray;
padding: 20px;
border: 2px solid black;
BE
Positioning
N
.fixed-box {
position: fixed;
O
top: 10px;
right: 20px;
I
}
AT
Position Description
C
static Default (normal position).
🔹 This will change the background color to yellow if the screen width is 600px or smaller.
6. CSS Animations
@keyframes slide {
0% { transform: translateX(0); }
100% { transform: translateX(100px); }
}
N
.box {
O
width: 100px;
I
height: 100px;
AT
background-color: red;
animation: slide 2s infinite alternate;
}
<!DOCTYPE html>
<html lang="en">
EH
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
BE
initial-scale=1.0">
<title>My First Styled Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 class="title">Welcome to My Website</h1>
<p>This is a simple webpage styled using CSS.</p>
<button class="btn">Click Me</button>
</body>
</html>
N
font-family: Arial, sans-serif;
}
O
.title {
I
AT
color: darkblue;
font-size: 30px;
text-transform: uppercase;
C
}
p {
U
font-size: 18px;
ED
color: gray;
}
.btn {
E
background-color: blue;
IV
color: white;
padding: 10px 20px;
border: none;
EH
cursor: pointer;
font-size: 16px;
}
BE
.btn:hover {
background-color: darkblue;
}
N
JavaScript Basics for Beginners
O
JavaScript (JS) is a programming language used to add interactivity, dynamic behavior,
I
AT
and logic to web pages. It works alongside HTML and CSS to create fully functional websites.
C
✔ Runs in all web browsers (no installation needed)
✔ Supports modern frameworks (React, Vue, Angular)
U
ED
JavaScript code is written inside HTML elements using the onclick or other event attributes.
EH
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script>
console.log("Hello from JavaScript!");
</script>
N
</body>
</html>
I O
AT
3️⃣ External JavaScript (Recommended)
C
Step 1: Create a JS File (script.js) U
console.log("Hello, this is an external JavaScript file!");
ED
2. JavaScript Basics
BE
N
let text = "Hello"; // String
O
let isTrue = true; // Boolean
let numbers = [1, 2, 3]; // Array
I
let person = {name: "Alice", age: 25}; // Object
AT
C
3️⃣ Operators
U
JavaScript supports arithmetic and comparison operators.
ED
let a = 10, b = 5;
console.log(a + b); // Addition (15)
console.log(a * b); // Multiplication (50)
console.log(a > b); // Comparison (true)
E
4️⃣ Functions
EH
function greet(name) {
return "Hello, " + name + "!";
}
console.log(greet("Alice"));
N
if (score > 80) {
console.log("Great job!");
O
} else {
console.log("Keep trying!");
I
}
AT
C
6️⃣ Loops (for, while)
let j = 1;
while (j <= 3) {
IV
}
BE
N
O
3️⃣ Changing Styles
I
document.getElementById("heading").style.color = "blue";
AT
4️⃣ Event Handling (Click Button)
C
document.getElementById("myButton").addEventListener("click",
function() {
U
ED
alert("Button Clicked!");
});
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
<style>
body { text-align: center; font-family: Arial; }
#box { width: 100px; height: 100px; background: red; margin:
auto; }
</style>
</head>
<body>
<h1 id="heading">Welcome!</h1>
<p>Click the button to change the box color.</p>
<div id="box"></div>
<button id="myButton">Change Color</button>
N
<script src="script.js"></script>
</body>
O
</html>
I
AT
2️⃣ Create script.js
C
document.getElementById("myButton").addEventListener("click",
function() { U
let box = document.getElementById("box");
let colors = ["red", "blue", "green", "yellow", "purple"];
ED
let randomColor = colors[Math.floor(Math.random() *
colors.length)];
box.style.backgroundColor = randomColor;
});
E
IV
Summary
BE