Full Stack Web Development
Full Stack Web Development
You →Y P → DNS S →G
And then, Google sends back the webpage to you! ✨
What is an IP Address?
Every computer has a special number called an IP Address . It's like a home address so other
computers can find it.
–
JavaScript makes your site do stuff like respond when you click something.
javascript
B ’
The browser puts it all together:
1. Reads HTML to build the stuff.
2. Reads CSS to make it pretty.
3. Reads JavaScript to add action.
html
You can pretend you're hacking the site (but really, it's just your screen hit refresh and it goes
away!).
Summary:
Part Job Emoji
HTML Structure / Content
CSS Colors / Looks
JavaScript Movement / Actions
Browser The builder and presenter
Main Idea:
Getting stuck in programming is inevitable but also essential to learning. The real growth comes from
solving those challenges.
Use these to capture only relevant parts of your screen useful for Q&A and debugging.
Mindset Advice:
• Everyone gets stuck even Angela does.
• Debugging is frustrating but deeply rewarding.
• Embrace bugs as learning opportunities even a missing comma can take hours but teaches
precision.
✅ Helpful Reminders:
• Getting stuck = part of becoming a great developer.
• Learn the process of debugging, not just the syntax.
• Build resilience it pays off when things click.
Understanding "HyperText"
• Hypertext = Text with links (hyperlinks) to other documents or pages.
• These are the blue links we click on clicking takes us to another page (another HTML file).
• It's the foundation of navigation in web pages.
x : "P j " k “H w ?” → H ML f
✅ Key Takeaways
Concept Meaning/Use
HTML The backbone structure/content of any website
HyperText Text that links to other documents/pages (via hyperlinks)
Markup System to annotate content (like tags)
HTML Tags Used to mark content: headings, paragraphs, links, etc.
First Website Made using only HTML by Sir Tim Berners-Lee
Tags vs Elements
Term Meaning
Tag Code inside angle brackets (e.g., <h1> or </h1>)
Element The whole block: opening tag + content + closing tag (e.g., <h1>Hello</h1>)
Example:
html
<h1>Hello World</h1>
Heading Levels:
Heading Use Case Size (Default)
<h1> Main title (Book title) Largest
<h2> Chapter title Smaller
<h3> Section title Smaller
<h4> Subsection title Smaller
<h5> Tiny headings Tiny
<h6> Smallest Smallest
A paragraph is like a box that holds a piece of text. In HTML, we use the <p> tag to start a paragraph
and </p> to end it.
How It Works:
Let's say we want to make 3 paragraphs:
• We use <p> to start each paragraph.
• We use </p> to end each one.
Code Example:
Here’s the code to separate 3 paragraphs:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Paragraph Example</title>
</head>
<body>
<p>This is the first paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>This is the second paragraph. Donec vel mauris quam. Nullam ac eros at ligula
tincidunt.</p>
<p>This is the third paragraph. Etiam vestibulum, turpis ac rhoncus varius, mi dui posuere
nisi.</p>
</body>
</html>
Key Point:
Using the <p> tag is important for separating paragraphs and making your text readable!
html
<hr />
html
<br />
L t’ T y It t C d !
Here’s how we can use these elements:
html
<!DOCTYPE html>
<html>
<head>
<title>Poem by William Blake</title>
</head>
<body>
<h1>William Blake</h1>
css
<ul>
<li>A</li>
<li>B
<ol>
<li>B1</li>
<li>B2
<ul>
<li>B2a
<ul>
<li>B2aa</li>
<li>B2ab</li>
</ul>
</li>
<li>B2b</li>
<li>B2c</li>
</ul>
</li>
<li>B3
<ol>
<li>B31</li>
<li>B32</li>
</ol>
</li>
</ol>
</li>
<li>C</li>
</ul>
Tip: Every new list is nested inside a <li> like layers in a sandwich .
2. The Coder
"Give me clean HTML to copy and learn."
html
<ul>
<li>A</li>
<li>B
html
<ul>
<ul>❌ wrong
Fix:
html
<ul>
<li>
<ul>✅ correct
html
<li>B2
<ul> ... </ul>
</li>
css
UL
LI A
LI B
OL
LI B1
LI B2
UL
LI B2a
UL
8. The Tester
"I’ll try and break it."
Challenge: What happens if you don’t close a <ul>?
Spooky HTML:
html
<li>B
<ul>
<li>B1
</ul>
<li>C</li>
9. The Designer
"Can I make it pretty?"
Nesting also changes how lists look on the page:
• ul uses bullets
• ol uses numbers
• Deeper nests →
So the final structure looks like this:
markdown
•A
•B
1. B1
2. B2
• B2
• B2
• B2 b
• B2b
• B2
3. B3
1. B31
2. B32
html
html
<tag attribute="value">Content</tag>
href Attribute
• Specific to the <a> tag.
• Without it, the anchor tag is not clickable.
• Example:
html
<a href="https://google.com">Google</a>
Global Attributes
• Can be used on any HTML element.
• Example:
html
✅ Goal
Create an ordered list (<ol>) of 5 favorite websites, each as a clickable hyperlink.
✅ Code:
html
html
<ol start="5">
<li><a href="https://example1.com">Site 1</a></li>
<li><a href="https://example2.com">Site 2</a></li>
<li><a href="https://example3.com">Site 3</a></li>
<li><a href="https://example4.com">Site 4</a></li>
<li><a href="https://example5.com">Site 5</a></li>
</ol>
html
html
html
Accessibility Tip
• Always use alt text unless the image is purely decorative.
• Screen readers will read the alt text aloud.
✅ Goal
Create a heading and add an image of a dog or cat with a proper alt tag.
✅ Code (Dog Example):
html
html
✅ Best Practices
1. Always add alt text for accessibility.
2. Use ./ when accessing files in the same folder.
3. Use ../ when going up a folder level.
4. Use VS Code's auto-suggestions to prevent errors.
5. If the image doesn't load → k y
Code Examples
Multi-Page website Page 24
Code Examples
✅ Access file in the same folder
html
html
html
html
project-folder/
index.html ←
about.html ← b
public/
contact.html ←
assets/
images/
cat.png
html
html
<a href="./public/about.html">
<img src="./assets/images/cat.png" alt="Cat image">
</a>
bash
assets/images/cat.png
Correct path in <img>:
html
✅ Common Mistakes
• ❌ Using href in <img> →
❌ Using a tag to show images → f b k b k
✅ Challenge Summary
1. Add a link to Contact Me page:
html
html
<a href="./public/about.html">
<img src="./assets/images/cat.png" alt="About Me">
</a>
○ <!DOCTYPE html>
○ <html>
▪ <head>
▪ <body>
○ </html>
This lesson covers the process of web hosting and how to make your website live on the internet. Here's
a summary:
1. Web Hosting Definition: It's the process of making your website available on the internet. This is
done by uploading your website files (like HTML, CSS, images) to a web server that is always
connected to the internet.
2. Local vs. Web Hosting:
○ Locally, the website files are stored on your computer, and you can only view the website on
your device.
○ With web hosting, you upload these files to a server, making the website accessible to
anyone, anywhere in the world.
3. Using GitHub for Hosting:
○ Create a repository on GitHub (public and with a README file).
○ Upload all your website files (including index.html, images, and other folders) to the
repository.
○ Ensure the index.html file is correctly named and includes your homepage code.
○ In GitHub settings, enable GitHub Pages by selecting the main branch to serve your website.
○ After a few minutes, you'll get a URL where your website is live.
4. Access and Share: Once the website is live, you can share the URL with anyone, allowing them to
view your portfolio or website.
This is a simple process that makes your website accessible globally. Next, the course will cover styling
your website with CSS to improve its appearance.
What is CSS?
Cascading = Waterfall
Imagine a waterfall .
• Water starts from the top (general) and falls down to the bottom (specific) .
• CSS works the same way! It starts with big rules (like “everything is blue”) and goes down to
smaller ones (like “only the title is red”).
A long time ago, websites were boring. They were only made with HTML, and everything looked the
same .
But then, we got CSS! This allowed us to:
• Separate content (HTML) from style (CSS).
• Now websites could look awesome!
html
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightblue; /* Page color */
}
h1 {
font-family: 'Arial'; /* Font for headings */
color: red; /* Text color */
}
</style>
html
html
<style>
h1 {
color: red;
}
</style>
html
Css
h1 {
color: green;
}
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Methods</title>
</head>
<body>
<h1>Choose a style:</h1>
<a href="inline.html">Inline CSS</a>
<a href="internal.html">Internal CSS</a>
<a href="external.html">External CSS</a>
</body>
</html>
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inline Style</title>
</head>
<body>
<h1 style="color: blue;">This is a blue heading (Inline)</h1>
</body>
</html>
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Internal Style</title>
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External Style</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a green heading (External)</h1>
</body>
</html>
css
h1 {
color: green;
}
Summary:
• Inline CSS is quick but not recommended for lots of styles.
• Internal CSS is useful for single-page projects.
• External CSS is the best for multi-page websites and easier to manage.
CSS Selectors
✅ What is a CSS Selector?
A CSS selector tells the browser which part of the HTML you want to style.
It’s like pointing at something in a webpage and saying:
“Hey, I want to change you!”
1. Element Selector
• What it does: Targets all elements of a particular HTML tag.
• Syntax:
css
h1 {
color: blue;
}
2. Class Selector
• What it does: Targets elements that have a specific class.
• Syntax:
css
.red-text {
color: red;
}
• HTML Example:
html
3. ID Selector
• What it does: Targets one unique element with an id.
• Syntax:
css
#main {
color: red;
}
• HTML Example:
html
4. Attribute Selector
• What it does: Targets elements with certain attributes or attribute values.
• Syntax:
css
p[draggable] {
color: red;
}
p[draggable="false"] {
font-size: 20px;
}
• Example:
○ Selects <p> tags that have the draggable attribute.
○ Or selects only those with draggable="false".
css
*{
margin: 0;
padding: 0;
}
css
p{
css
#main-title {
text-align: center;
}
css
.large-text {
font-size: 24px;
}
css
button[disabled] {
background-color: gray;
}
css
img[alt="logo"] {
width: 100px;
}
Recap
Selector Type Example Used For
Element h1 {} All <h1> tags
Class .btn {} Group of elements
Mini Exercise
You're given a plain HTML file with:
html
<body>
<h1>Hello, CSS!</h1>
< 2>L t’ l t !</ 2>
</body>
Task
Use CSS to:
1. Set the background color of the <body> to antiquewhite
2. Change the <h1> text color to whitesmoke
3. Set the <h1> background color to cornflowerblue
4. Change the <h2> text color using a hex code (choose your favorite!)
5. Set the <h2> background color using a different hex code
✅ Sample Solution
css
body {
css
p{
color: red;
}
2. font-size
Controls how big or small the text appears.
Units of Measurement:
Unit Meaning Approx. Size
px Pixels – tiny square dots (1px ≈ 0.26mm) Static size
pt Points – often used in Word (1pt ≈ 0.35mm) Static size
em Relative to parent's font size Flexible
rem Relative to root (html) font size More consistent
Example:
css
html {
font-size: 20px;
}
body {
font-size: 1rem; /* 20px */
}
h1 {
font-size: 2em; /* 2 × body = 40px */
}
Remember:
• em changes if the parent changes.
• rem stays stable unless the root size (html) changes.
3. font-weight
Sets how bold the text appears.
Values:
• normal = default
• bold = thicker
css
p{
font-weight: 700; /* bold */
}
css
h1 {
font-family: "Times New Roman", serif;
}
css
html
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
rel="stylesheet">
css
body {
font-family: 'Roboto', sans-serif;
}
Practice Exercises
✅ Exercise 1: Set the root font size and use rems
CSS Properties Page 42
✅ Exercise 1: Set the root font size and use rems
Task: Set html to 16px, and make h1 = 2rem, p = 1rem.
html
<style>
html {
font-size: 16px;
}
h1 {
font-size: 2rem; /* 32px */
}
p{
font-size: 1rem; /* 16px */
}
</style>
html
<style>
body {
font-size: 20px;
}
div {
font-size: 20px;
}
div p {
font-size: 1.5em; /* 1.5 × 20px = 30px */
}
</style>
css
code {
font-family: "Courier New", monospace;
}
strong {
font-weight: 800;
✅ Summary
Feature What It Does
Elements Tab Inspect HTML and see CSS styles applied
Styles Section Shows all rules, can live-edit
Computed Tab Shows final rendered styles
CSS Overview Summary of fonts, colors, backgrounds, etc.
Live Editing Safe way to test CSS changes without breaking code
css
div {
width: 200px;
height: 150px;
}
2. Border
• Adds a line around the element.
• Takes 3 values: thickness, style, color.
css
div {
border: 5px dashed red;
}
• You can modify specific sides:
css
border-top: 0px;
• Or use shorthand for multiple sides:
css
3. Padding
• Space between content and border.
• Increases the inside space, doesn't affect the actual size (unless box-sizing is changed).
css
CSS Properties Page 47
css
div {
padding: 20px;
}
4. Margin
• Space outside the border.
• Controls distance between elements.
css
div {
margin: 10px;
}
css
Div Element
• <div> = invisible box/container.
• Used to group content.
• No visual by default unless styled.
html
<div>
<p>Text</p>
<img src="..." />
</div>
Exercise
Task:
Style a <div> to look like a content box with the following:
• Width: 200px, Height: 100px
• Padding: 10px
• Margin: 20px
• Border: 5px solid green
Code:
html
css
.box {
width: 200px;
height: 100px;
padding: 10px;
margin: 20px;
border: 5px solid green;
}
✅ Output:
A green-bordered box that says "Hello World!" with inner spacing and space from other elements.
Main Idea:
CSS is called Cascading Style Sheets because when multiple rules apply to the same element, the
browser uses a process called the cascade to decide which rule takes effect.
css
li { color: red; }
li { color: blue; }
Example:
If a list item has:
html
css
li { color: blue; }
.first-class { color: green; }
[draggable] { color: purple; }
#first-id { color: orange; }
Example:
html
This inline style will override anything written in external or internal stylesheets.
4. Importance (!important)
Adding !important to a CSS rule makes it the strongest, even stronger than inline styles.
Example:
css
h1 {
color: blue !important;
}
Even if inline style says style="color: red", the !important will win → x blue.
Quiz Recap
Q1: Which color is applied?
html
css
css
✅ Answer: Green – Both are classes (same specificity), but the one written later wins.
Tip
W y CSS “ ’ w k ,” k :
• Is another style overriding it?
• Is it written earlier in the file?
• Are you using a more general selector?
• Do you need to be more specific?
css
h1, h2 {
color: blueviolet;
}
Targets both <h1> and <h2> elements and makes their text blueviolet.
css
.box > p {
color: firebrick;
}
Targets only <p> elements that are direct children of an element with class box.
It won’t target nested elements like grandchildren.
css
.box li {
color: blue;
}
Targets all <li> elements inside any element with class box.
✔ Works even if the <li> is nested multiple levels deep.
css
h1.big.heading {
font-size: 32px;
}
Targets only <h1> elements with both class big and class heading.
No space allowed between chained selectors.
Exercises
Exercise 1: Group Selectors
Make both the <h1> and <h2> text color blueviolet.
css
h1, h2 {
color: blueviolet;
}
css
.box > p {
color: firebrick;
}
css
.box li {
color: blue;
css
h1.big.heading {
text-transform: uppercase;
}
Summary Table
Selector Type Syntax Targets...
Group h1, h2 Multiple selectors
Child .box > p Direct children only
Descendant .box p Any nested elements inside a parent
Chained h1.big.heading One element matching all selector conditions
ta
• Default positioning.
• Elements appear in the normal flow (one after the other).
• Does not respond to top, left, right, bottom.
Think of it like: Books stacked in a pile. You can't move them unless you pick one up with special
instructions.
CSS Example:
css
div {
t : tat ; /* T d a lt; y d ’t v dt t t */
top: 50px; /* Has no effect */
}
la v
• Element stays in the document flow but you can shift it.
• top, left, right, bottom move it relative to where it would have been.
Think of it like: Moving a sticky note slightly on your monitor, but it still belongs in the same row.
CSS Example:
css
div {
position: relative;
top: 50px;
left: 50px;
}
Use when: You need to nudge elements slightly without breaking layout.
A l t
• Completely removed from the normal flow.
• Positioned relative to the nearest ancestor with a position other than static.
• f , ’ entire page (html).
Think of it like: F b ’ ff
CSS Example:
css
.outer {
position: relative;
}
.inner {
position: absolute;
top: 50px;
left: 50px;
}
Key Rule: Always wrap absolute inside a relative container to control where it floats.
d
• Always relative to the browser window (viewport).
• D ’t v when you scroll the page.
Think of it like: Pinning a note to your screen. Scroll the document, it still stays.
CSS Example:
css
div {
position: fixed;
top: 50px;
left: 50px;
}
Use when: You want a sticky navigation bar, floating button, or alert that stays in view.
Bonus: z-index
• Controls which element is "on top".
• Higher z-index = sits above lower ones.
css
div {
position: absolute;
z-index: 100;
}
Practice Exercise
HTML:
html
<div class="container">
<div class="box">A</div>
</div>
Tasks:
1. Try each positioning type one by one.
2. Set top: 20px; left: 30px and observe.
3. Add position: relative to .container and position: absolute to .box. See the difference.
1. Display: Block
• Default for: <div>, <p>, <h1> etc.
• Behavior: Takes up 100% width of its container, forces next element onto a new line.
• Can set: width, height, padding, margin.
Example:
html
Think of it like:
A refrigerator that insists on occupying the entire kitchen row by itself.
html
Think of it like:
Words in a sentence they just flow next to each other.
html
Think of it like:
Books on a shelf. Each can have its own size, but they still line up next to each other.
4. Display: None
Advanced CSS Page 59
4. Display: None
• Completely hides the element.
• Element won't take space on the page.
Example:
html
Think of it like:
Invisible ink it's there in the code, but y a ’t t at all.
✅ Mini Exercises
Task 1: Align 3 Squares Horizontally
Given: 3 <p> tags, each 200px x 200px.
Goal: Line them up side-by-side (horizontally).
Solution:
css
Why?
inline-block lets the squares sit inline and retain width and height.
css
p{
display: block;
}
Why?
block elements naturally stack vertically.
Interactive Demo
Visit this page to play around:
appbrewery.github.io/css-display
Try changing display values live and observe layout changes.
Key Takeaways
css
img {
float: left;
}
➡ This causes text next to the image to wrap around the image on the right side.
Float Values:
Value Effect
left Floats the element to the left
right Floats the element to the right
none Default (no float)
footer {
clear: both;
}
✅ Step-by-Step Solution
css
1. Media Queries
Used to apply CSS rules only at certain screen sizes.
How it works:
• You write a CSS rule like this:
Css
This means:
If screen is 600px or less, hide the navigation bar.
✅ Use different breakpoints for different devices (mobile, tablet, etc.).
2. CSS Grid
Used to create 2D layouts (rows + columns).
How it works:
• First, set container:
css
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 200px 200px;
gap: 30px;
}
css
.first {
grid-column: span 2;
}
3. Flexbox
Used for 1D layouts (only row or only column).
How it works:
css
.container {
display: flex;
}
.card {
flex: 1;
height: 100px;
}
css
html
<div class="container">
<div class="row">
<div class="col">...</div>
<div class="col">...</div>
</div>
</div>
html
<div class="box-container">
<div class="box">Box 1</div>
<div class="box">Box 2</div>
</div>
CSS:
css
.box-container {
display: flex;
}
.box {
flex: 1;
padding: 20px;
background-color: lightblue;
border: 1px solid blue;
text-align: center;
}
@media (max-width: 600px) {
.box-container {
flex-direction: column;
}
}
css
@media (condition) {
/* CSS styles */
}
Basic Keywords
1. @media – starts the media query.
2. max-width – targets screens up to a certain width (e.g., mobile).
3. min-width – targets screens from a certain width (e.g., desktop).
4. and – used to combine conditions.
5. screen – optional keyword to target screen devices (vs. print for printers).
css
div {
width: 200px;
height: 200px;
background-color: blue;
}
Combining Conditions
Target devices between 600px and 900px:
css
• screen → f ( f )
• print → f f
Example:
css
@media print {
body {
background: white;
color: black;
}
}
Exercise
Task: Change body background color based on screen size.
Requirements:
• Mobile: 319–480 x →
• Tablet: 481–1200 x → w b
• Laptop: 1201–1600 x →
• Desktop: 1601px and up →
• Default: aquamarine
✅ Solution Code
css
body {
background-color: aquamarine;
}
/* Mobile */
Testing Responsiveness
Use Chrome Developer Tools:
• Press Ctrl + Shift + I or right-click → " "
• Click on the device toolbar icon ( )
• Switch between devices or use custom width
css
.container {
display: flex;
}
css
FlexBox Page 71
Your HTML:
html
<div class="container">
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
<li>Blog</li>
</ul>
</div>
css
ul {
list-style: none; /* remove bullet points */
padding: 0;
margin: 0;
display: flex; /* make the <ul> a flex container */
gap: 20px; /* add space between <li> items */
}
TIP: You apply display: flex to the ul, not the lis. That turns the list into a row!
Summary
Technique Good for Avoid for
<table> Tabular data Page layout
inline-block Basic alignment Complex layouts
float Text wrap Modern layouts
Flexbox Layouts, spacing
FlexBox Page 72
Untitled
Sunday, May 4, 2025 2:21 PM
2. Flex Container
When you apply display: flex to a container:
• All children become flex items.
• By default, Flexbox arranges items in a row (left to right).
• flex-direction: row; → H z y
• flex-direction: column; → V y
css
.container {
display: flex;
flex-direction: column;
}
Now the main axis is vertical, so all items stack top to bottom.
5. flex-basis
• Sets the initial size of a flex item along the main axis.
○ In row → width
○ In column → height
So:
css
FlexBox Page 73
.container > * {
flex-basis: 100px;
}
css
.container > * {
/* applies to all direct children */
}
7. inline-flex vs flex
• display: flex; → k full width
• display: inline-flex; → y k as much width as needed
Exercise Summary
Goal:
Change a default horizontal Flexbox layout into a vertical one with each item 100px tall.
Given:
HTML:
html
<div class="container">
<div>Red</div>
<div>Orange</div>
<div>Yellow</div>
...
</div>
Solution in CSS:
css
.container {
display: inline-flex; /* shrink to fit content */
flex-direction: column; /* stack top to bottom */
}
.container > * {
flex-basis: 100px; /* each item is 100px tall */
}
FlexBox Page 74
}
FlexBox Page 75
Untitled
Sunday, May 4, 2025 2:35 PM
css
.green {
order: 3;
}
• All items default to order: 0.
• Larger order = item moves further right (in a row layout).
css
.container {
flex-wrap: wrap;
}
css
.container {
justify-content: center; /* or flex-start, flex-end, space-between, space-around, space-evenly
*/
}
✅ Examples:
FlexBox Page 76
✅ Examples:
• flex-start: items aligned left.
• center: items in the middle.
• space-between: equal spacing between items.
• space-around: equal space around items.
• space-evenly: equal space between and around.
Set on parent.
css
.container {
align-items: center; /* or flex-start, flex-end, stretch, baseline */
}
css
.item-special {
align-self: flex-start;
}
Visual Summary
Property Axis Set On Effect
order N/A Child Reorders items visually
flex-wrap Main Parent Controls wrapping of child items
justify-content Main Parent Horizontal distribution
align-items Cross Parent Vertical alignment of all items
align-self Cross Child Vertical alignment of one item
Exercise
HTML:
html
<div class="container">
<div class="box red">Red</div>
<div class="box green">Green</div>
<div class="box blue">Blue</div>
FlexBox Page 77
<div class="box blue">Blue</div>
</div>
CSS Task:
1. Set display: flex and flex-direction: row.
2. Make the .green box appear last using order.
3. Make all items wrap when screen is small.
4. Align all items to the bottom.
5. Make .blue float to the top (use align-self).
FlexBox Page 78
Untitled
Sunday, May 4, 2025 2:39 PM
Setting width
css
.item {
width: 100px;
}
Using flex-basis
css
.item {
flex-basis: 200px;
}
FlexBox Page 79
• Still shrinks if there's not enough space.
✅ Remember: flex-basis > width
Setting max-width
css
.item {
flex-basis: 200px;
max-width: 100px;
}
Setting min-width
css
.item {
flex-basis: 200px;
min-width: 300px;
}
Practice Exercise
HTML
html
<div class="container">
<p class="item">Short</p>
<p class="item">Medium text</p>
<p class="item">ReallyReallyLongWordWithoutSpaces</p>
</div>
CSS
css
.container {
display: flex;
gap: 10px;
}
.item {
flex-basis: 150px;
FlexBox Page 80
flex-basis: 150px;
max-width: 200px;
min-width: 100px;
}
✅ What Happens?
• Tries to make each item 150px.
• Won’t go above 200px.
• Won’t go below 100px.
• The long word forces a minimum width based on that word.
Summary
Property Controls Overrides
min-width Smallest allowed size Everything smaller
max-width Largest allowed size flex-basis, width
flex-basis Preferred size (main axis) Overrides width
width Fallback size (if nothing else) Content width
Content width Based on text or elements Last fallback
FlexBox Page 81
Untitled
Sunday, May 4, 2025 3:09 PM
Flexbox vs Grid
Flexbox Grid
One-dimensional layout Two-dimensional layout
Works in a row OR column Works in rows AND columns
Good for small UI elements Great for full page layouts
css
.container {
display: grid;
grid-template-columns: 1fr 2fr;
grid-template-rows: 1fr 1fr;
}
• Creates a layout with:
○ 2 columns (2nd column is twice as wide)
○ 2 equal-height rows
3. fr (fractional unit)
• A flexible unit for defining column/row sizes.
• 1fr 2fr = 1 part and 2 parts of the available space.
4. gap
• Controls spacing between rows and columns (like margin).
Grid Page 82
css
gap: 10px;
HTML Setup
html
<div class="container">
<div class="white"></div>
<div class="black"></div>
<!-- ...repeat 64 times -->
</div>
Your Goal:
• Create an 8x8 chessboard using CSS Grid.
• Each square: 100px x 100px
✅ Solution:
css
.container {
display: grid;
grid-template-columns: repeat(8, 100px);
grid-template-rows: repeat(8, 100px);
}
.white {
width: 100px;
height: 100px;
background-color: #f0d9b5; /* Light tile */
}
.black {
width: 100px;
height: 100px;
background-color: #b58863; /* Dark tile */
}
Grid Page 83
Untitled
Sunday, May 4, 2025 3:11 PM
Goal: Learn how to size rows and columns in CSS Grid to match
your layout needs.
1. Fixed Sizing
• Use pixels (px) or rem to set exact sizes.
css
2. Shorthand: grid-template
You can write both rows and columns like this:
css
3. Auto Sizing
css
Grid Page 84
5. MinMax Function
css
6. Repeating Rows/Columns
css
css
grid-auto-rows: 300px;
grid-auto-columns: 150px;
Exercise
Try this grid layout and observe the behavior:
html
<div class="grid-container">
<div>1</div><div>2</div><div>3</div><div>4</div><div>5</div>
</div>
css
.grid-container {
display: grid;
grid-template-columns: repeat(2, 200px);
grid-template-rows: repeat(2, 150px);
grid-auto-rows: 100px;
gap: 10px;
}
• How many rows will appear?
• What height will the 5th item have?
✅ Expected: 3 rows; the third one is auto-created with 100px height.
Grid Page 85
Untitled
Sunday, May 4, 2025 3:06 PM
css
This eliminates the need for using margin or padding to separate grid items.
css
.container {
display: grid;
height: 100vh; /* Makes it full screen vertically */
}
• display: grid enables Grid mode.
• 100vh means the container takes up the full height of the viewport.
css
css
.item {
display: flex;
justify-content: center; /* center horizontally */
align-items: center; /* center vertically */
}
Tip: Flexbox is perfect for aligning items within grid items. Use both together!
.cowboy {
grid-column: span 2; /* spans two columns */
}
Equivalent to:
css
grid-column-start: auto;
grid-column-end: span 2;
This tells the grid item to start at the default position and span across 2 columns.
css
grid-column-start: 2;
grid-column-end: 4;
css
Grid Page 87
grid-column-end: -1; /* last line on the right */
: 1 f last line w b f
css
grid-column-start: 4;
grid-column-end: 2;
css
grid-row-start: 1;
grid-row-end: 3; /* spans two rows */
Or simply:
css
grid-row: span 2;
Summary of Terms
Term Meaning
Container The element with display: grid
Item The children inside the grid container
Cell A single unit where an item can sit
Track A column or row
Line Borders between tracks
Gap Space between lines (not visible lines)
Challenge Practice
Task: Center each emoji using Flexbox inside the grid items.
css
.emoji-item {
display: flex;
justify-content: center;
align-items: center;
}
Grid Page 88
}
Grid Page 89
Untitled
Sunday, May 4, 2025 3:15 PM
Introduction to Bootstrap
What is Bootstrap?
Bootstrap is a popular CSS framework created in 2010 by Twitter developers Mark Otto and Jacob
Thornton.
A CSS framework is a pre-written set of CSS code that helps us build responsive, beautiful
websites faster.
Real Example
HTML Button Without Bootstrap
html
<button>Home</button>
→L k
HTML Button With Bootstrap
html
→L k y , , y
html
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
Bootstap Page 90
html
<script src="https://cdn.jsdelivr.net/npm/bootstrap@
5.3.0/dist/js/bootstrap.bundle.min.js"></script>
html
Pros vs Cons
✅ Pros
• Easy to use
• Saves time
• Pre-made UI components
• Good for quick projects
• Works well on all browsers
❌ Cons
• Class Bloat: Too many class names in HTML
• Harder to customize every detail
• May rely too much on framework, less on core CSS learning
✅ Final Result:
A fully styled Bootstrap card with a sunflower image, centered both vertically and horizontally.
Solution:
Bootstap Page 91
html
Bootstap Page 92
Untitled
Sunday, May 4, 2025 3:16 PM
html
<div class="container">
<div class="row">
<div class="col">Your content here</div>
</div>
</div>
html
<div class="col-2">2/12</div>
<div class="col-4">4/12</div>
<div class="col-6">6/12</div>
3. Responsive Breakpoints
Use breakpoints to control how content looks on different devices:
Class Applies On Screens Wider Than
col-sm- 576px (small phones)
col-md- 768px (tablets)
col-lg- 992px (laptops)
col-xl- 1200px (desktops)
col-xxl- 1400px (large screens)
Example:
html
Bootstap Page 93
<div class="col-sm-12 col-md-6 col-lg-4">Content</div>
4. Fluid Containers
• container: Fixed width with responsive breakpoints.
• container-fluid: Full width (100%) on all screen sizes.
• container-md: Full width starting from medium screens (≥768px).
html
<div class="col-2">2</div>
<div class="col-4">4</div>
<div class="col">auto</div>
html
✅ Practice Exercise
Task:
Create 2 divs inside a row:
• Each div should be 50% on desktop (XL)
• And 100% on mobile (SM)
✅ Solution:
html
<div class="container">
<div class="row">
Bootstap Page 94
<div class="row">
<div class="col-sm-12 col-xl-6">Box 1</div>
<div class="col-sm-12 col-xl-6">Box 2</div>
</div>
</div>
✅ Explanation:
• col-sm-12: Full width on small screens.
• col-xl-6: Half width (6/12 = 50%) on desktops.
Tip
If no width is defined (col), Bootstrap auto-splits the row evenly among the columns. But if screen size is
smaller than the defined breakpoint, all columns will stack vertically.
Bootstap Page 95
Untitled
Sunday, May 4, 2025 3:31 PM
W at’ D t T M d l ?
• Until now, we focused on functionality HTML and CSS to build websites.
• N w, w ’ f design making websites look beautiful and user-friendly.
W at Y ’ll L a N t
1. Color Theory – choosing colors that work together.
2. Typography – using fonts effectively.
3. UI Design (User Interface) – designing buttons, forms, and layout.
4. UX Design (User Experience) – creating smooth, pleasant user journeys.
✅ Exercise
Question: Look at one of your favorite websites.
1. Write down the first 3 design features that catch your eye (e.g., colors, layout, fonts).
2. Then write:
○ What feeling does the design give you (trust, fun, professional)?
○ Would you pay more for a product from that website? Why?
Color Combinations
1. Analogous Colors
○ Colors next to each other on the color wheel (like red + orange).
○ Best for calm, smooth designs (e.g., navbar + background).
○ ✅ Harmonious, ❌ Doesn’t pop much.
2. Complementary Colors
○ Opposites on the color wheel (like red + green).
○ Great for highlights, logos.
○ ✅ High contrast, ❌ Not good for text + background combos (too jarring).
3. Triadic Palette
○ 3 colors forming a triangle on the color wheel.
○ Balanced and colorful (good for playful themes).
4. Square Palette
○ 4 colors equally spaced around the color wheel.
○ More complex, vibrant designs.
Tools to Use
• Adobe Color – Try different palettes like Analogous, Triadic, etc.
• ColorHunt.co – Ready-made color palettes by designers.
Practice Exercise
WEB design school Page 97
Practice Exercise
Task: Choose the best color palette for each website type from the options below.
1. Bank Website
• A. Red + Yellow
• B. Blue + Grey
• C. Purple + Pink
2. Organic Grocery Store
• A. Green + Light Brown
• B. Red + Black
• C. Yellow + Purple
3. Fitness App
• A. Blue + Orange
• B. Pink + Green
• C. Grey + Dark Purple
✅ Solutions
1. B – B = → f f f
2. A – G =N /F → f
3. A – B =S b y, O = y→ f f
–
✅ Why Typography Matters
• Typography isn't just about choosing a favorite font.
• The font you use sends a message and creates a mood just like colors.
• The wrong font can make your design look unprofessional or send the wrong signal (e.g.,
romantic message in a horror font!).
The more contrast between thick and thin, the more modern the font looks.
2. Sans-Serif Fonts
• No feet, clean ends.
• Look simple, friendly, modern, and approachable.
• Better for:
○ Websites
○ Startups
○ Body text (more readable)
Subcategories of Sans-Serif:
Subtype Traits Examples
Humanist Natural, readable shapes Gill Sans, Tahoma, Verdana
Grotesque Rigid, less readable Akzidenz-Grotesk, Franklin Gothic
Fun Fact:
A study at MIT showed that drivers read dashboards faster when Humanist fonts were used vs.
Grotesque 30–40% faster, potentially saving lives!
’
Some fonts are hard to work with and look unprofessional:
• Comic Sans
• Papyrus
• Curlz MT
• Jokerman
• Bradley Hand
• Vivaldi
Only use them if your target audience is 5 years old or you're running a lemonade stand .
Exercise
Task: Design a simple quote poster using the following:
• One serif font for the quote.
• One sans-serif f f ’
• Use different weights (bold/light).
• Try matching the mood of both fonts (e.g., both serious, or both modern).
Example:
"Design is intelligence made visible."
Alina Wheeler
(Use Playfair Display for the quote and Open Sans for the author)
○ :B = ! H b !
• Real-life Example:
○ ASOS uses green/red to grab attention on important actions like Add to Cart.
W t a : v T t at !
• What is it?
○ White space is the empty space around elements that makes them stand out.
• How it works:
○ Luxury Branding uses lots of space to look expensive.
○ = B t a = !
• Example:
○ A l ’ ad use minimal text and big white space to make their products feel premium.
Practical Tips
• Apply hierarchy to highlight the important stuff.
• Mix up your layout to keep things interesting!
• Align elements to create a polished look.
• Use white space to make things look clean and modern. ✨
• Always consider your audience and design for them.
Exercises
1. Exercise 1: Redesign a birthday invite
○ Apply hierarchy: Bold colors, varied sizes.
○ Solution: Make the title bold, date and time prominent, and location secondary.
2. Exercise 2: Evaluate a webpage (e.g., Wikipedia)
○ Suggest a better layout.
○ Solution: Shorten line lengths to 40-60 characters, add images, and space out sections.
3. :L at a d t ad
○ Suggest using white space to improve it.
○ Solution: Remove excess text, space out features, and make the product image the focus.
Takeaway
• UI Design is about making things easy to use, visually appealing, and tailored to your audience.
• Always use hierarchy, good layout, alignment, white space, and audience awareness to create
top-notch designs! ✨
• Dark patterns ky k w ’ b f f b b
harmful to the user.
Examples of Dark Patterns:
1. Wa t a d w k f ,b ’ air
2. Amazon's Delivery Button - Always trying to get you to pay more for Express Delivery.
3. Snapchat Ad - C k " " ’ y k
4. ya a ’ t aC a - Hidden dropdowns make it hard to opt-out of travel insurance.
5. Confusing Checkboxes - "Stop not sending you deals" – what?!
• Remember: Good UX is about helping users, not tricking them!
Takeaway:
• User Experience should be invisible, like paved paths that let people move around easily.
• Keep things simple, consistent, and user-friendly to ensure a delightful experience. ✨
Takeaway
• JavaScript = the backbone of modern web development.
• Essential for building interactive, responsive, and real-time apps.
• Learn JS first if you want to build websites & web apps.
alert("Hello");
alert("World");
○ First pop-up → "H ", → "W "
alert("Hello!");
alert("World");
• H (b )→ x by
• ✅ Console = quick testing, Snippets = writing reusable scripts.
Programming Grammar
Analogy
• ; = period in English.
• "Hello" = text string, not code.
• Programming languages = different grammar rules (JS vs Python vs Ruby).
Takeaway
• Console = test 1 line.
• Snippets = write real scripts.
• Use MDN for valid keywords/functions.
• Follow style guides → , f
Strings
• Defined using quotation marks " "
• Everything inside quotes = string (text data)
• Example:
alert("Hello World");
• C “ ”b ’ string of characters, like a string of pearls.
• Found in all programming languages.
Numbers
• Just type them (no quotes needed).
• Example:
2 + 3 // → 5
l a
• Data that is either true or false.
• Example:
true
false
• Essential for logic & conditions.
typeof 23 // "number"
typeof "Angela" // "string"
typeof true // "boolean"
Takeaway
• Programming = dealing with different types of data.
• Main primitive types in JS:
○ String (text)
○ Number
○ B ( /f )
• Data types = foundation block for websites & web apps.
prompt() Keyword
• Creates a pop-up like alert(), but allows user input.
• Example:
Variables
• Used to store data in memory.
• Example:
Syntax Breakdown
myName = "Jack";
• Now the same box stores "Jack" instead of "Angela".
I ta t l
• Use var only when creating a variable.
• D ’ w changing/updating it.
Challenge Example
• Show variable value with alert:
alert(myName);
var gameLevel = 1;
gameLevel = 2;
alert("Your level is currently: " + gameLevel);
• Start with 1, update as game progresses.
• Computer remembers value in the variable.
Takeaway
• Variables = storage boxes for data.
• prompt() = ask user for input, store inside variable.
• No need to repeat → j f b
Initial Setup
var a = 3;
var b = 8;
// Write your code here
Step-by-Step Thinking
1. You a ’t d tly a a and b because you’d overwrite one of them.
Example:
2. Just like with buckets of sand and water, you need a temporary container to hold one value while
switching.
Solution
var a = 3;
var b = 8;
// Your code
= ; // ’ (3) f y
a = b; // now a becomes 8
b = temp; // b takes the saved 3
Output
console.log("a is " + a); // a is 8
console.log("b is " + b); // b is 3
✅ This works, follows all rules:
• No changing existing code
• No typing numbers
• No redeclaring a or b
var a = 3;
var b = 8;
Goal → Sw =8 b=3
❌ What NOT to Do
• D ’ :
a = 8; b = 3; // ❌ not allowed
• D ’ b :
✅ Correct Solution
Use a temporary variable as a placeholder, like a spare bucket:
a→8
b→3
Key Takeaway
• Think of variables as containers (or buckets).
• When swapping, you need a third container to temporarily hold data.
• Logic first → y x
Interview Tip:
This problem is a classic coding interview question. The interviewer cares more about your reasoning
process ( “b k y”) j f y x
"Hello"
'World'
b :A ""b w w !
✅ Key Takeaways
• Strings can be joined with +.
• Spaces must be manually added inside strings (" ") or before/after variables.
• You can combine variables + strings in alerts, prompts, or console logs.
Comments in JavaScript
• Single-line comment: // text
• Multi-line comment:
/*
This is a
multi-line comment
*/
✅ Key Takeaways
• .length tells you how many characters are in a string.
• Can be used to build features like word/character counters.
• Comments (// or /* */) are useful to document code.
string.slice(startIndex, endIndex);
• Returns characters from startIndex up to but not including endIndex.
x (z b )
Examples
var name = "Angela";
name.slice(0, 1); // "A" → f
name.slice(5, 6); // "a" →
name.slice(0, 3); // "Ang" → 0,1,2
name.slice(1, 5); // "ngel" → 1,2,3,4
✅ Key Takeaways
• .slice(0, 140) → x f 140
• Perfect for enforcing input limits (like Twitter).
• Can shorten multi-line code into one-liners by nesting functions.
Hello Angela
Step-by-Step Breakdown
1 tt ’ a
var name = prompt("What is your name?");
2. Extract the first letter (index 0)
var firstChar = name.slice(0,1);
3. Extract the rest of the name (everything after index 0)
var restOfName = name.slice(1, name.length);
4. Format properly
• First char →
• Rest → w
firstChar = firstChar.toUpperCase();
restOfName = restOfName.toLowerCase();
5. Recombine
var capitalizedName = firstChar + restOfName;
6. Display greeting
alert("Hello, " + capitalizedName);
✅ Full Code
var name = prompt("What is your name?");
var firstChar = name.slice(0,1);
var restOfName = name.slice(1, name.length);
firstChar = firstChar.toUpperCase();
restOfName = restOfName.toLowerCase();
var capitalizedName = firstChar + restOfName;
alert("Hello, " + capitalizedName);
⚡ One-liner (advanced)
Introudction to JS ES6 Page 118
⚡ One-liner (advanced)
If you want to shrink it:
7. Display Greeting
alert("Hello, " + capitalizedName);
• Output: "Hello, Angela"
✅ Key Lesson
Programming = breaking problems down into smaller chunks.
• Big problem → b b → fy by
• Test with edge cases → k f f
Takeaway
• .slice(start, end) → x f
• .toUpperCase() & .toLowerCase() → x
• Always test with edge cases (weird user input).
• The process of breaking down problems is more important than memorizing shortcuts.
Steps
1. Get user’s name with prompt()
2. Capitalize first letter
3. ➕ Concatenate first letter + rest of name
4. Greet user with alert()
I lat t aa t
var firstChar = name.slice(0, 1);
• slice(0, 1) → k y f
Ma tl a
var upperCaseFirstChar = firstChar.toUpperCase();
t t t a
var restOfName = name.slice(1, name.length);
Ma tl a ( d t)
restOfName = restOfName.toLowerCase();
C at at al a
var capitalizedName = upperCaseFirstChar + restOfName;
t
alert("Hello, " + capitalizedName);
Full Code
var name = prompt("What is your name?");
var firstChar = name.slice(0, 1);
Key Takeaways
• Break big problems into small steps
• slice(start, end) → x f
• .toUpperCase() → k
• .toLowerCase() → k w
• Concatenation (+) → j
• Always test for edge cases
Numbers in JavaScript
➕ B
• Add: +
• Subtract: -
• Multiply: *
• Divide: /
2 + 3 // 5
7 - 4 // 3
5 * 2 // 10
10 / 2 // 5
• 9%6→3( f 9 ÷ 6)
• 6%4→2
• 12 % 8 → 4
✅ Use case: check even/odd
if (num % 2 === 0) {
console.log("Even");
} else {
console.log("Odd");
}
Operator Precedence
• Multiply & divide before add & subtract
3 + 5 * 2 // 13
(3 + 5) * 2 // 16
Use parentheses → & f
Dog Age
Formula:
(dogAge−2)×4+21( A − 2) × 4 + 21( A −2)×4+21
Code:
var dogAge = prompt("How old is your dog?");
var humanAge = ((dogAge - 2) * 4) + 21;
alert("Your dog is " + humanAge + " years old in human years.");
Example:
• Dog = 7 → H = 41
Takeaways
Introudction to JS ES6 Page 124
Takeaways
• %→ ( f / k)
• Always think about order of operations
• Use () parentheses for clarity
• Prac ce with small challenges (like Dog Age converter )
Why Functions?
• Imagine a robot (Angela) → -by-step instructions to get milk
• Without functions → f ❌
• With functions → k one block ✅
Function Structure
function getMilk() {
console.log("leaveHouse");
console.log("moveRight");
console.log("moveUp");
console.log("buyMilk");
console.log("moveDown");
console.log("moveLeft");
console.log("enterHouse");
}
Parts:
• function → k yw f
• getMilk → ( C )
• () → (f )
• {}→ yb (b k f )
getMilk();
• No function keyword here → j by
• Runs everything inside { }
Style Tips
• Indent code inside { } for readability
• Closing curly brace does not end with ;
• Function calls (getMilk();) do end with ;
Takeaways
• Functions = reusable blocks of instructions
• Define once, call many times → k D Y (D ’ Y f)
• Use console.log for developer messages, alert for user messages
function main() {
// your code here
}
• Basic commands:
○ move() → f w
○ turnLeft() → 90° f
○ putBeeper() → b
○ pickBeeper() → k b
function diagonalMoveAndBeeper() {
move();
turnLeft();
move();
putBeeper();
turnRight(); // custom turnRight function can be written
}
function turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
function main() {
putBeeper(); // first tile
diagonalMoveAndBeeper();
diagonalMoveAndBeeper();
diagonalMoveAndBeeper();
diagonalMoveAndBeeper();
}
Takeaways
• main() = starting point
• Functions help remove repetition (DRY principle)
• Break problems into smaller reusable steps
• Start with simple moves → b b
Next lesson: Functions with inputs (parameters)
function sayHello() {
console.log("Hello!");
}
sayHello(); // "Hello!"
function getMilk(money) {
var numberOfBottles = Math.floor(money / 1.5);
console.log("Buy " + numberOfBottles + " bottles of milk.");
}
getMilk(5);
// → B y 3 b f k
⚡ Key Takeaways
• Parameters = function inputs (like variables).
• Use them to make functions flexible.
• Math.floor() is handy when you need whole numbers.
• fy ’ k→G /f ( k round down JS).
Goal
Write a function lifeInWeeks(age) → :
1. Assume:
○ 365 days/year
○ 52 weeks/year
○ 12 months/year
○ Lifespan = 90 years
2. Calculate remaining years:
console.log("You have " + days + " days, " + weeks + " weeks, and " + months + " months left.");
✅ Full Function
function lifeInWeeks(age) {
let yearsRemaining = 90 - age;
let days = yearsRemaining * 365;
let weeks = yearsRemaining * 52;
let months = yearsRemaining * 12;
console.log("You have " + days + " days, " + weeks + " weeks, and " + months + " months left.");
}
Example Run
lifeInWeeks(12);
Output:
You have 28470 days, 4056 weeks, and 936 months left.
Notes
• Order matters: bmiCalculator(weight, height) ✅
• Use meters (e.g., 170 cm → 1 70)
• ** is exponent; you can also use Math.pow(height, 2)
Example Usage
var bmi = bmiCalculator(65, 1.8);
console.log(bmi); // 20
Takeaway
• function → f b b k
• return → b k
• Math.pow() → x
• Math.round() →
• Always test with realistic inputs ✅
Setup
• Folder → DOM/
• Files:
○ index.html
○ styles.css (blank for now)
○ index.js (later)
2. Internal JavaScript
<script>
alert("Hello");
</script>
• JS is written inside <script> tags
• Executes as browser parses the HTML
alert("Hello");
Placement Matters
• CSS → < >( y before content)
• JavaScript → bottom of <body> (after HTML is created)
Example:
<body>
Best Practices
• Put <script> just before </body>
• Keeps site fast (HTML loads first, JS later)
• External JS files keep code clean & reusable
<html>
<head></head>
<body>
<h1>Hello</h1>
<button>Click Me</button>
</body>
</html>
DOM tree (simplified):
document
html
head
body
h1
button
3. Change style
heading.style.color = "red";
Properties vs Methods
• Properties = describe object
car.drive(); // method
document.querySelector("input").click(); // simulates a click
Properties → ()
Methods → w y ()
Challenge
Select the 3rd <li> and change its text to your name (via console, not HTML).
Solution hint
document.querySelector("ul li:nth-child(3)").innerHTML = "Your Name";
Takeaway
• DOM = bridge between HTML/CSS ↔ J S
• Use dot notation to access properties/methods
• Manipulate HTML on the fly = interactivity
2. getElementsByClassName()
• Selects all elements with a given class.
• Also returns an array-like collection.
document.getElementsByClassName("btn")[0].style.color = "blue";
3. getElementById()
• Selects a single element by its id.
• Ids must be unique per page.
4. querySelector()
• Returns the first matching element.
• Accepts CSS-style selectors:
○ h1 → by
○ #id → by
○ .class → by
○ Combine: "li.item", "ul#list li a"
document.querySelector("h1"); // first h1
document.querySelector("#title"); // element with id="title"
document.querySelector(".btn"); // element with class="btn"
document.querySelector("ul#list li a"); // <a> inside list
5. querySelectorAll()
• Returns all matching elements (NodeList).
Key Differences
• t l t y… → b ,
• querySelector / querySelectorAll → f x b , CSS ,
Challenge Recap
Change the Google link inside the list to red:
Takeaway
• Use querySelector/querySelectorAll in most cases (flexible, powerful).
• By f y k w ’ y q
• Always remember: collections need indexing before style changes.
document.querySelector("h1").style.color = "red";
document.querySelector("h1").style.fontSize = "10rem";
Remember
• Values must be strings in JS ("10rem", "yellow", "7%").
• Even numbers with units must be quoted.
button {
background-color: yellow;
}
JavaScript way:
document.querySelector("button").style.backgroundColor = "yellow";
Practice Ideas
• Try toggling:
document.querySelector("h1").style.visibility = "hidden";
• Change spacing:
document.querySelector("h1").style.padding = "20px";
• Play with multiple properties via DevTools console.
Next Lesson
• Separation of Concerns
Keep styles in CSS and just toggle/add/remove classes with JavaScript ⚡.
document.querySelector("h1").style.color = "red";
This mixes behavior + style.
<h1 id="title"><strong>Hello</strong></h1>
document.querySelector("#title").innerHTML;
// Output: "<strong>Hello</strong>"
document.querySelector("#title").innerHTML = "<em>Good Bye</em>";
// Renders: *Good Bye* (italicized)
M t ""b ’
textContent
• Returns or sets only the text, no tags.
• Safer if you just want raw text.
document.querySelector("#title").textContent;
// Output: "Hello"
document.querySelector("#title").textContent = "Good Bye";
// Renders: Good Bye (plain text, no HTML effect)
✨ Key Differences
• innerHTML → x + HTML tags.
• textContent → only text (ignores tags).
• innerHTML can render HTML but is riskier (can cause XSS if user input is inserted directly).
• textContent is safer if you only need plain text.
1. Get Element
document.querySelector("a")
Selects the first <a> element.
2. List Attributes
document.querySelector("a").attributes
✅ Returns a list of attributes for that element.
Example → f=" :// "
document.querySelector("a").setAttribute("href", "https://bing.com");
Updates the link’s target, but text stays the same (Google).
Example in Action
<a href="https://google.com">Google</a>
<script>
var link = document.querySelector("a");
console.log(link.getAttribute("href")); // google.com
link.setAttribute("href", "https://bing.com");
</script>
Now clicking Google → B
Key Takeaways
• .attributes → b
alert("JS linked!");
B
1. Create a function to handle clicks:
function handleClick() {
alert("I got clicked!");
}
2. Select the first button and add event listener:
document.querySelector("button").addEventListener("click", handleClick);
Why no parentheses?
• handleClick → f f ( )
• handleClick() → y( w w w )
document.querySelector("button").addEventListener("click", function() {
alert("I got clicked!");
});
function respondToClick() {
console.log("I got clicked!");
}
element.addEventListener("click", respondToClick); // correct called on click
Anonymous function:
element.addEventListener("click", function() {
console.log("I got clicked!");
});
Important: respondToClick ≠ respondToClick()
• respondToClick (no ()) passes the function so the browser calls it later.
• C k() y (y ’ w w )
debugger;
calculator(3,4,multiply);
• Use step controls to see calculator receive operator as a function and how it calls multiply.
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
var audio = new Audio("sounds/tom-1.mp3");
audio.play();
});
✅ Now clicking any button plays tom-1.mp3 instead of an alert.
.w {
background-image: url("images/tom1.png");
}
.a {
background-image: url("images/tom2.png");
}
.s {
background-image: url("images/tom3.png");
}
.d {
background-image: url("images/tom4.png");
}
.j {
background-image: url("images/snare.png");
}
.k {
background-image: url("images/crash.png");
}
.l {
background-image: url("images/kick.png");
}
document.querySelectorAll(".drum")[i].addEventListener("click", function() {
console.log(this.innerHTML); // shows button text
});
this.innerHTML tells us which drum button was clicked.
switch(expression) {
case 'value':
// code to execute
break;
default:
// code if no case matches
}
3. Our plan: Switch on buttonInnerHTML → b k
case 'w':
tom1.play();
break;
2. ‘ ’ -2 drum
case 'a':
tom2.play();
break;
3. Repeat for: s, d, j, k, l → y ff
4. Important: Always end each case with break → f “f ”⛔
default:
console.log(buttonInnerHTML);
Step 5: Test It
1. Save → f w b
2. Click bu ons → d t d lay a
3. ext step: keyboard events → y ad f k
Key Takeaways:
1. Switch statement = cleaner than multiple if-else ✅
2. Use meaningful variable names →
3. Break after each case → b ⛔
4. Include a default case → x
5. Test your code → k y w k x
Pro Tip: Think of switch as a decision tree. Each case is a branch, and the default is the safety net at
the bottom.
var bellBoy1 = {
name: "Timmy",
age: 19,
hasWorkPermit: true,
languages: ["English", "Spanish"]
};
• Access properties using dot notation:
console.log(bellBoy1.name); // Timmy
• Tip: Different objects have different properties (bellboy vs. housekeeper).
Key Takeaways
1. Objects group related properties and methods into one structure ✅
2. Use dot notation to access object properties: object.property
3. Constructor functions help create multiple similar objects efficiently
4. Capitalized function name + new keyword` = signals object creation.
5. Objects = cleaner, scalable, and less error-prone than standalone variables.
Pro Tip:
Think of objects like blueprints for employees.
• BellBoy blueprint → , , ,
• HouseKeeper blueprint → , x , k
• Factory = constructor → y w ff w b ✨
bellBoy1.moveSuitcase = function() {
alert("May I take your suitcase?");
// code to move suitcase
};
• Call the method:
bellBoy1.moveSuitcase();
• Remember: Dot notation works for both properties and methods. ✅
Pro Tip:
Think of an object as a person:
• Properties = traits (name, age, experience)
• Methods = actions they can perform (moveSuitcase, clean, play sound)
• Dot notation = w y “ k ” k ✨
Java t: D t y ad y
Goal:
• Make your drum kit respond to keyboard keys as well as button clicks.
• Example: Press w → -1 ,P j→
document.addEventListener("keypress", function(event) {
alert("Key was pressed");
});
• Tip: Event names are all lowercase (keypress). Check MDN docs for accurate names.
• Key idea: Add the listener to the entire document, not a specific button.
document.addEventListener("keypress", function(event) {
console.log(event);
});
• Logs keyboard event object → :
○ key → k y
○ keyCode → fk y
○ other properties
• Most important: event.key → f k y ✅
function makeSound(key) {
switch(key) {
case 'w':
tom1.play();
break;
case 'a':
tom2.play();
break;
// ... other cases
}
}
• Call makeSound() from both button click and keyboard keypress.
document.addEventListener("keypress", function(event) {
makeSound(event.key);
});
• Sends the key value of the pressed keyboard key to makeSound().
Key Takeaways
1. Event listeners can be added to elements or the entire document.
2. y a d v t give a lot of info, but event.key is usually all you need.
3. Functions as parameters: Pass makeSound to event listeners →
4. Unified function =D Y (D ’ Y f)
5. JavaScript callbacks → after events happen.
Pro Tip:
Think of it like a translator:
• B k yb k y k ff “ ”→ k S () b
same action: play a drum.
function buttonAnimation(currentKey) {
var activeButton = document.querySelector("." + currentKey);
activeButton.classList.add("pressed");
}
• Parameter: currentKey → f b k y
document.querySelector("." + currentKey);
• Dot + key → CSS f ( w, k)
activeButton.classList.add("pressed");
setTimeout(function() {
activeButton.classList.remove("pressed");
}, 100); // 0.1 second delay
• Result → b f b f y, y
Key Takeaways
1. Use querySelector + dynamic class to select the right element. ⌨
2. Use classList.add() to apply CSS animations. ✨
3. Use setTimeout() to revert animation → f ff ⏱
4. One function handles both button clicks and keyboard presses → D Y ✅
5. Combines JavaScript events + DOM manipulation + CSS for interactive UX.
Pro Tip:
Think of it like a real drum kit:
• You press a key or hit a pad → lights up and makes sound.
• Same feedback for all inputs keeps the user confident they pressed the right key.
Introduction to jQuery
What is jQuery?
• jQuery is the most popular JavaScript library.
• A library = pre-written code you can use to simplify your own projects.
• Created by John Resig to make JavaScript easier, shorter, and more readable.
document.querySelector("h1");
○ jQuery:
Key Takeaways
• jQuery = a tool to reduce JavaScript complexity.
• Use $() shorthand for querying elements.
• Makes DOM manipulation, event handling, and animations simpler.
• Think of it like shortcuts in UX design: achieves the same functionality with less effort.
UX Perspective:
• jQuery improves developer efficiency → f f user experience.
• Less verbose code = faster iteration → b ,f X
jQ y
• Download directly from jquery.com or use a CDN (Content Delivery Network).
• Recommended: Google CDN → b w b y f →f
load.
• Latest version (as of lesson): 3.3.1 (could be newer).
j t t
• Create project folder → jQ y
• Create files:
1. index.html
2. styles.css
3. index.js
• Link CSS in <head>:
<script src="index.js"></script>
✅ Including JS at the end ensures HTML elements exist before manipulation.
T a L
• Change body background color in CSS → f w k
• Add test JS alert:
alert("Working");
• Refresh browser → k CSS
Add TML l t
• Example:
<h1>Hello</h1>
<button>Click Me</button>
<button>Click Me</button>
<button>Click Me</button>
<button>Click Me</button>
<button>Click Me</button>
a jQ y y ta
• $→ f jQ y
• Example: change h1 color to red:
$("h1").css("color", "red");
• Equivalent:
jQuery("h1").css("color", "red");
I l d jQ yL ay
• Copy script tag from Google Hosted Libraries.
• Place above your JS script tag in HTML:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="index.js"></script>
• ❌ Wrong order → $ f
• ⚠ Avoid putting both scripts in <head> without ready() → y y b f
library is loaded.
D t ady M t d
• Ensures jQuery code runs after page is fully loaded:
$(document).ready(function() {
$("h1").css("color", "red");
});
• Alternative → at end of body → ff , y()
y Ta a ay
1. $ = jQuery shorthand → ,
2. Script order matters → jQ y b y before your JS.
3. Document ready → f b f DOM
4. Use jQuery to select elements and manipulate CSS easily.
Pro Tip:
Including scripts at the end of body is often simpler than using $(document).ready() → DOM
elements exist when JS runs.
W at aM dL a y?
• Minified files look like a “huge mess” when opened in a browser.
• Example: jQuery from a CDN appears as one long line of code.
• Purpose: Reduce file size for faster loading in browsers.
W at a D M a
• Removes:
○ Spaces
○ New lines
○ Comments
• Keeps all functional code intact.
• Makes file smaller → f w f
a l
• Original index.js for drumkit: 1539 bytes
• Minified version: 1113 bytes → 426 bytes saved
Effect: Less bandwidth, quicker load times, same functionality.
t M yY C d
• Use minifier.org
1. Paste your JS or CSS code.
2. Select language (JS or CSS).
3. Click Minify →
W yM a Ma
• Browsers ignore whitespace, tabs, and comments → y yf x
• Minification improves performance, especially for slower connections.
• Standard practice for production websites.
a ada l v M d
• Libraries usually provide both:
1. Readable version → f / z
2. Minified version → f /b w
• If no customization needed → y f f f CDN w
Key Tip:
Always use minified files in production to improve website speed, but keep the readable version for
development and debugging.
W y l I ta t
• To manipulate elements, you first need to select them.
• Standard JavaScript uses:
document.querySelector("h1");
document.querySelectorAll("button");
jQ y l
• $ is shorthand for jQuery.
• Selecting elements becomes shorter and cleaner:
C l t C a l ty
• You can use any CSS selector inside $():
l M l l l t
• Unlike querySelector vs querySelectorAll in JS, $() handles both single and multiple elements
seamlessly:
Key Tip:
Using $() makes your code more concise, flexible, and CSS-like, which is one reason jQuery became
popular.
T () M t d
• Purpose: Change or get CSS properties of selected elements.
• Syntax:
Cla I t ad D t tyl
• Better Practice: Keep CSS in the stylesheet; keep behavior in JS.
• Steps:
1. Define a CSS class in styles.css:
.big-title {
font-size: 10rem;
color: yellow;
font-family: cursive;
}
2. Use jQuery to add/remove the class:
Add M l l Cla
• Separate class names with a space inside .addClass():
$("h1").addClass("big-title margin-50");
• Example CSS:
.margin-50 {
margin: 50px;
}
• Both classes will be applied simultaneously.
C a l t a a Cla
• Method: .hasClass()
Key Tips:
• Using classes keeps behavior (JS) and styles (CSS) separate cleaner and more maintainable.
• .css() is useful for dynamic or one-off style changes.
• .addClass(), .removeClass(), and .hasClass() are essential for interactive styling
T a () M t d
• Purpose: Get or set the value of an HTML attribute.
• Syntax:
a A t
• Example: Getting the src of an image:
console.log($("img").attr("src"));
○ Prints the current src value of the image element(s).
a A t
• Example: Changing the href of an anchor tag:
$("a").attr("href", "https://www.yahoo.com");
○ Updates all anchor tags to point to Yahoo instead of Google.
• If you check after running:
console.log($("a").attr("href")); // "https://www.yahoo.com"
Cla A A t T
• The class attribute can also be read or changed with .attr():
Key Notes:
• One argument → get the attribute value
• Two arguments → set the attribute value
• Works with all HTML attributes: src, href, alt, title, class, etc.
• Useful for dynamically updating links, images, or any element property.
T l () M t d
• Adds a click event listener to one or more elements.
• Syntax:
$("selector").click(function() {
// code to execute when clicked
});
• Example: Change an h1 color on click:
$("h1").click(function() {
$(this).css("color", "purple");
});
• Bonus: jQuery automatically applies the listener to all matching elements, no need for loops.
t v tM t d
• Similar to .click(), jQuery has other shorthand methods like:
○ .keypress() → k y k
○ .mouseover() →
○ .keydown() / .keyup() → f k y
D t yt
• Detecting keystrokes inside an input:
$("input").keypress(function(event) {
console.log(event.key); // logs which key was pressed
});
• Detecting keystrokes on the entire page:
$(document).keypress(function(event) {
$("h1").text(event.key); // show the key in the h1
});
T () M t d
• More flexible than .click() or .keypress().
• Syntax:
$("selector").on("event", function() {
// code to execute
});
• Example: Detect mouseover on an h1:
$("h1").on("mouseover", function() {
$(this).css("color", "purple");
});
✅ Key Points
• jQuery simplifies event handling, no loops needed for multiple elements.
• .on() is versatile and often preferred for dynamic content.
• Event object (event) gives access to properties like event.key.
• Use .text() to update the text of elements dynamically.
()
• Adds content before the selected element (outside of it).
• Example:
$("h1").before("<button>New</button>");
○ Adds a button before the <h1> element.
a ()
• Adds content after the selected element (outside of it).
• Example:
$("h1").after("<button>New</button>");
○ Adds a button after the <h1> element.
d()
• Adds content inside the selected element, at the start (right after the opening tag).
• Example:
$("h1").prepend("<button>New</button>");
○ The button appears before the text content of the <h1>.
a d()
• Adds content inside the selected element, at the end (right before the closing tag).
• Example:
$("h1").append("<button>New</button>");
○ The button appears after the text content of the <h1> but still inside the <h1>.
Removing Elements
• Use .remove() to delete elements from the DOM.
• Example:
Key Notes:
• before() and after() → outside the element.
• prepend() and append() → inside the element.
• These methods give you precise control over where new elements appear.
• .remove() is simple but powerful for dynamic cleanup.
$("button").click(function() {
$("h1").toggle();
});
ad A a
• Gradual change in opacity:
○ .fadeOut() → S w y
○ .fadeIn() → S w y w
○ .fadeToggle() → f /f O
$("button").click(function() {
$("h1").fadeToggle();
});
ld A a
• Vertical slide effects:
○ .slideUp() → C w
○ .slideDown() → x w w
○ .slideToggle() → b w / D w
$("button").click(function() {
$("h1").slideToggle();
});
C t A a t a at ()
• Allows numeric CSS properties to gradually change:
○ Can animate opacity, margin, height, width, etc.
○ Cannot animate colors or non-numeric values.
$("button").click(function() {
$("h1").animate({
opacity: 0.5,
marginLeft: "20px"
});
});
C a A a
• Apply multiple effects in order by chaining methods:
Key Tips
• Animations like .fadeIn(), .slideDown(), .animate() make the UI feel more dynamic.
• Only numeric CSS values can be used in .animate().
• Use chaining to combine multiple animations in sequence.
• D ’t t d a know what exists and how to find them via:
○ jQuery documentation
○ Google searches or Stack Overflow
a ll
• Bash: Bourne Again Shell, a popular CLI for Unix-like systems.
• Unix-like systems examples:
○ Linux distributions
○ Mac OS / macOS
• Windows equivalent: DOS / PowerShell
• Why use Bash?
○ Speed: Quickly execute commands like creating folders, moving files, etc.
○ Control: Access hidden files, configuration, and advanced system settings.
○ Flexibility: Full control over operations without the GUI constraints.
a a C a d
• Create directory: mkdir Music → M k wf
• List all files (including hidden): ls -a
• Create hidden folder: mkdir .Secrets
Tip: Press the up arrow to repeat previous commands saves time!
W yL a CLI?
• GUI hides many details; CLI gives you full visibility of the system.
• Essential for Web Development, Back-end Development, and Version Control (Git).
• Many developers prefer CLI for speed and control over tasks.
a al t
• Faster folder creation and navigation.
• Access hidden or system files easily.
• Crucial for advanced developer tasks like Git, server management, and automation scripts.
Summary:
The Bash shell is a powerful tool for developers. It provides speed, precision, and control that GUI
interfaces often hide. Learning Bash early makes you a more efficient and capable developer.
C a D t
• Command: cd <folder> → C y f
○ Example: cd Documents → D f
• Tab auto-completion: Start typing a folder name and press Tab to auto-complete.
• Navigating multiple levels:
cd Documents/Learn/Languages
○ Moves through the full path in one command.
a ad
• Parent directory: cd .. → G
• Chain to go multiple levels up:
Q Nav a T
• Return to user root: cd ~
• Cycle previous commands: use up ↑ and down ↓ keys.
• Edit anywhere in a command line: hold Option/Alt and click to move the cursor.
• Move cursor to start/end:
○ Ctrl + A → b f
○ Ctrl + E → f
• Clear current line without executing:
○ Ctrl + U →
W y T T
• Efficient keyboard navigation saves time over using a mouse.
• Useful for:
○ Navigating deeply nested directories.
○ Executing long commands quickly.
○ Avoiding repetitive typing with auto-completion and history.
mkdir Angela
• Navigate into the directory: cd Angela
• Check contents: ls → b y y
a al I t a v C a dL
• GUI: Open an editor like TextEdit → f → y
• Command Line: touch <filename> → wf y
○ Example:
touch Text2.txt
l
• Default app:
open Text2.txt
• Specify application:
Deleting Files
v a l l
• Command: rm <filename>
rm Text.rtf
v All l aD t y
• Wildcard *: matches all files.
rm *
I ta t Ca
• Always check your location before using destructive commands (rm) with pwd or ls.
• C ’ y k G
Removing Directories
v ty D t y
• Command:
rm -r Angela
• Removes directory and all child files/folders.
Da C a d Wa
• sudo rm -rf / --no-preserve-root → w y ( +f + )
• Moral: with great power comes great responsibility. Always double-check your path and target.
Key Notes
• Check current location: pwd → f
• List files/folders: ls → w
• Wildcard *: selects everything inside current directory.
• Command line provides power and efficiency, but mistakes can be destructive.
Summary:
Command-line file and directory manipulation is faster, more precise, and scriptable. Use mkdir, touch,
rm, and rm -r carefully. Always check your path before destructive commands.
Key Takeaways
1. Git = time machine for your code ⏳
2. Version control = save points you can revert to
3. Compare versions → see what changed
4. Roll back anytime → recover from mistakes
5. Git = teamwork tool → easier collaboration
Pro Tip:
Step 1: Setting Up
• Open Terminal → D k :
cd Desktop
• Create a project folder called Story:
mkdir Story
cd Story
• Check contents → b y:
ls
• Create a text file → 1 x:
touch chapter1.txt
• Open and edit le → y
git init
• Creates .git folder (hidden) → G
• Working directory = your project folder (Story)
git status
○ Red = untracked (not staged)
○ Green = staged (ready to commit)
• Add file to staging:
git add .
• Commit changes:
git log
○ Shows unique hash, author, timestamp, and commit message
• HEAD = points to current position/version in repository
git status
• See differences between last commit and current file:
Pro Tip:
• Staging area lets you pick which files to track → w f b
committed.
• Commit often → , b
• HEAD always shows your current version checkpoint
# User/system files
.DS_Store
# Sensitive data
secrets.txt
• You can also use wildcards:
git rm --cached -r .
Step 4: Commit
git add .
git status # only files not ignored are staged
# Node dependencies
node_modules/
# Environment variables
.env
# System files
.DS_Store
• Initialize & commit as usual:
git init
git add .
git commit -m "Initial commit"
Tips
• Always include API keys & secrets in .gitignore
• Use comments (#) to organize ignored files
• .gitignore works locally → y w G H b
W y Cl l ’ j t?
1. Customize it for your needs.
2. Extend functionality the original project doesn’t have. ⚡
3. Fix bugs.
4. Learn by studying someone else’s code.
• Example: self-hosted apps as alternatives to paid services (e.g., project management tools, email
servers).
cd repository-name
4. Install dependencies (if Node.js project):
npm install
Key Takeaways
1. Cloning = local copy of remote repository ✅
2. Use git clone <URL> + npm install + npm start to run projects locally
3. Modify & experiment to improve programming skills ✨
4. Open source = learning + contribution opportunity
5. Future skill: Branches, Pull Requests, Merging for collaboration
Pro Tip:
• Think of cloning like standing on the shoulders of giants ’w k f
and create more efficiently.
git add .
git commit -m "modify chapter 1 and 2 to have alien theme"
3. Switch back to main branch:
git add .
git commit -m "add chapter 4"
5. Merge experimental branch into main:
Key Takeaways
1. Branching = safe experimentation without affecting main branch ✅
2. Merging = integrate successful experiments back into main branch
3. Always check current branch with git branch before committing ✨
4. Push merged changes to remote repository to sync with GitHub
5. Large projects often have multiple active branches for features & bug fixes
Pro Tip:
• Think of branches like side roads:
○ You can explore new ideas without disrupting the highway (main branch)
○ Merge your detour back if it turns out to be a great path
Scenario
• You own a remote repository on GitHub (Angela)
• Someone else (Bangela) wants to propose changes
• Direct write access = trusted contributors only
• Others can suggest changes via Forks + Pull Requests
Step 1: Forking
• Fork = duplicate a remote repository into your own GitHub account
• Gives you full permissions on your copy
• Original repository remains protected from untrusted changes
Workflow:
1. Find the repository you want to contribute to
2. Click Fork → y w x y
3. Clone your fork locally if needed:
git add .
git commit -m "Add space themes to chapter 4"
git push origin master
Collaboration Tips
• Fork → →P → w kf w = f
• Contributions can range from:
○ Simple edits (README, docs)
○ Bug fixes
○ Feature additions
• GitHub network graphs visualize fork & merge history
• Review & feedback are essential → f teamwork & learning
Real-Life Example
• Forked Story repo → fy chapter 4
• Commit changes on fork → → P
• Original owner reviews & merges → f
• Shows contributor history & merges in GitHub Network graph
Benefits
• Safe collaboration without compromising main code
• Encourages open-source contribution
• Learn teamwork & code review process
• Build reputation in developer community
Pro Tip:
• Start contributing by forking libraries you use → fx →P →
gradual larger contributions
• Treat GitHub like a social network for developers