The Odin Project Notes
The Odin Project Notes
A collection of notes
Joshua Bilsland
Contents
Foundations – Introduction ............................................................................... 2
How This Course Will Work............................................................................. 2
Introduction to Web Development ................................................................. 3
Motivation and Mindset ................................................................................. 3
Asking For Help ............................................................................................... 4
Join the Odin Community ............................................................................... 4
Foundations – Prerequisites .............................................................................. 5
Computer Basics ............................................................................................. 5
How Does the Web Work?.............................................................................. 5
Installation Overview ...................................................................................... 6
Installations .................................................................................................... 6
Text Editors ..................................................................................................... 7
Command Line Basics ..................................................................................... 7
Setting Up Git ................................................................................................. 7
Foundations – Git Basics .................................................................................... 8
Introduction to Git .......................................................................................... 8
Git Basics ........................................................................................................ 9
Foundations – HTML Foundations ................................................................... 10
Introduction to HTML and CSS ...................................................................... 10
Elements and Tags ........................................................................................ 11
HTML Boilerplate .......................................................................................... 12
Working with Text ........................................................................................ 14
Lists............................................................................................................... 15
Links and Images ........................................................................................... 17
Commit Messages......................................................................................... 18
Project: Recipes ............................................................................................ 19
Foundations - CSS Foundations ........................................................................ 19
CSS Foundations ........................................................................................... 19
Inspecting HTML and CSS (Chrome) .............................................................. 28
The Box Model .............................................................................................. 30
Block an Inline............................................................................................... 32
Foundations - Flexbox ...................................................................................... 33
Introduction to Flexbox................................................................................. 33
Growing and Shrinking .................................................................................. 34
Axes .............................................................................................................. 35
Foundations – Introduction
How This Course Will Work
• “The Odin Project is an open-source community dedicated to providing
the best information sources to take you from zero to a full-stack
developer”
• Will go over the basics of internet, Git, GitHub, HTML, CSS, JS, back-end
technologies, etc
• Lessons will contain questions that should be answered before moving
on
• After the foundations course, the Full Stack JavaScript and Full Stack
Rails paths can be taken
• A collection of the best sources that could be found by the community
• Some things made by the community themselves
Introduction to Web Development
• Web development is project-focused and involves collaborating with a
team that helps to co-ordinate the client’s needs into the end product.
• Front end:
o What the website visitors see
o The presentation of content and user interface elements
o Use of HTML, CSS, and JavaScript
• Back end:
o “The guts of the application”
o Stores and serves data to ensure the front end has what it needs
o Uses languages such as Java, Python, and Ruby
• Full Stack:
o Developers that are comfortable working with both the front and
back ends
o The Odin Project focuses on teaching full-stack development
• Can work for large tech companies, startups, as a freelancer, or as a
consultant
• https://web.archive.org/web/20160925155912/http://www.happybears
oftware.com/how-to-get-a-programmer-job.html
• Can help add to the project (Will be good for CV)
• https://github.com/kamranahmedse/developer-roadmap
• https://stackoverflow.com/help/how-to-ask
• https://slash7.com/2006/12/22/vampires/
Knowledge Check Answers:
1. Context or code
2. Where someone asks for help with Y to assist their solution with X
when they really should be using an alternative X. Asking about their
attempted solution rather than their actual problem.
3. Doesn’t google things/read docs, doesn’t ask specific questions, asks
common questions that have already been answered before
Foundations – Prerequisites
Computer Basics
• https://edu.gcfglobal.org/en/computerbasics/what-is-a-computer/1/
• https://edu.gcfglobal.org/en/computerbasics/understanding-operating-
systems/1/
• https://edu.gcfglobal.org/en/computerbasics/understanding-
applications/1/
• https://edu.gcfglobal.org/en/basic-computer-skills/open-source-vs-
closed-source-software/1/
• https://edu.gcfglobal.org/en/techsavvy/taking-screenshots/1/
• https://edu.gcfglobal.org/en/techsavvy/password-tips/1/
Knowledge Check Answers:
1. Windows is an operating system
2. Open-source software is software where the source code is publicly
accessible and usable. Closed source software is the opposite.
3. Showing error messages to show IT support and showing evidence of
code for exams.
4. Weak: password123 → Strong: P4$$w0rD231
Installation Overview
• Dual-booting is where you install two operating systems on your
computer, which can give you the option to boot either OS when your
computer first starts up.
• A virtual machine is an emulation of a computer that runs within your
existing OS.
Installations
• The Odin Project recommends using either a virtual machine or dual-
boot to use Linux as it doesn’t support windows.
Text Editors
• “A good text editor can help you write better code with real-time code
checking, syntax highlighting, and automatic formatting.”
• Microsoft Word and Libre-Office Writer cannot be used as they store
information about how to display the text on the screen which means
interpreters unable to execute the file as code.
• Code editors are tools that can take a text file an provide features such
as plugins, syntax highlighting, auto-closing of brackets and braces, and
linting. Visual Studio Code (VSCode) is the most popular choice.
Setting Up Git
• Git is a popular version control system.
• GitHub allows you to upload code/files using Git and manage your code
using a web interface.
Git Basics
• ‘git clone’ is used to clone the contents of a repository to the current
directory.
• ‘git remote’ gives you the URL of the repository you are using.
• ‘git status’ displays the state of the working directory and the staging
area.
• ‘git add fileName’ will add a file to the staging area. The staging area is
part of the two-step process for making a commit in Git.
• ‘git commit’ makes a ‘save point’ in the repository.
• ‘git log’ shows a log of all previous commits, who made them, message
given to the commit, etc.
• ‘git push’ updates a remote branch with local commits.
Knowledge Check Answers:
1. A new repository can be made on GitHub by clicking the ‘new’ button
2. The ‘git clone’ command can be used to copy a repository to your
local machine
3. ‘Origin’ is the default name of your remote connection
4. origin refers to the remote
5. main refers to the branch you are pushing to
6. You add files to the staging area and the use commit to commit the
changes
7. git status
8. ‘git add -A’ or ‘git add fileName’
9. git commit -m “message”
10. git push
11. git log
HTML Boilerplate
• All HTML documents have the same basic structure or boilerplate.
• index.html is the name for the main page of the website. It is the default
page shown on a website if no other page is specified when a visitor
requests the site. This name should always be used for this page since it
is what web servers will look for by default.
• Every HTML page starts with a doctype declaration. It is used to tell the
browser what version of HTML it should use to render a document.
<!DOCTYPE html> will use the most recent version of HTML.
• VSCode has a built-in shortcut which will generate a boilerplate. This can
be used by entering ! on the first line of a blank HTML document.
• https://www.youtube.com/watch?v=V8UAEoOvqFg&list=PL4-
IK0AVhVjM0xE0K2uZRvsM7LkIhsPT-&t=93s
• https://validator.w3.org/
Knowledge Check Answers:
1. The doctype declaration is used to tell the browser what version of
html it should use to render the file in.
2. The HTML element is the root element which every other element
will be a descendant of.
3. The head element is where all the meta data about the website is
stored.
4. The body element is where all the content of the website is put.
Lists
• An unordered list can be created by using the <ul> tag. Items can be
added by using the <li> tag. The items should be placed between the
<ul> tags. An example can be seen below.
• An ordered list can be created by using the <ol> tag. Items can be added
by using the <li> tag. The items should be placed between the <ol> tags.
An example can be seen below.
Commit Messages
• Commit message history will be helpful if you come back to a project
after a while as you will be able to read through the changes and
processes you were doing.
• It is best practice to commit every time you have a meaningful change in
the code. This will create a timeline of progress.
• https://cbea.ms/git-commit/
Knowledge Check Answers
1. Good commit messages and a good commit history can be beneficial
as it makes going back to old projects easier. It also makes it easier
for other people to understand what you are doing, why you are
doing it, and how you are doing it.
2. No more than 50 characters for the subject line.
Project: Recipes
For this project, I had to create a website that has a menu with links to
different recipe pages (that I created).
GitHub Link: https://github.com/JoshuaBilsland/odin-recipes
• The <div> tag is used as a container for HTML elements - which is then
styled with CSS or manipulated with JavaScript.
• Selectors refer to the HTML elements to which the CSS rules apply (what
is being selected for each CSS rule)
o The universal selector will select elements of any type. The syntax
for it is an asterisk.
o The type selector (or element selector) will select all elements of a
given element type. The syntax is the name of the element.
o The class selector will select all elements with the given class. The
class is an attribute you place on an HTML element.
• Positioning elements is about deciding how you are going to nest and
stack these boxes.
• Padding - Change the size of the space between the edge of a box and
the content inside of it.
• Margin - Change the space between a box and any other that sit next to
it.
• Border - Add space between the margin and padding.
• https://www.youtube.com/watch?v=rIO5326FgPE
• Top and bottom margins collapse. The largest Margin between two
boxes will merge rather than add together. If two boxes have a
margin of 60px, there will be a gap of 60px between them not 120px.
• “box-sizing: border-box;” will make the padding and border included
in the width and height.
• https://developer.mozilla.org/en-
US/docs/Learn/CSS/Building_blocks/The_box_model
• There are two types of boxes - block boxes and inline boxes. Boxes
have an inner display and an outer display.
• https://css-tricks.com/almanac/properties/m/margin/
Knowledge Check Answers
1. The properties of the box model go padding -> border -> margin.
2. box-sizing lets you include the padding and border in the element’s total
width and height.
3. The standard box model lets you define a height and width for the box.
Any padding and border is then added to those height and width values
to give it a final total size. In the alternative box model, the padding and
border is taken away from the width and height and so the box stays
true to the height and width values.
4. Margins are used to create space between two boxes.
5. Padding is used to create space between the content of a box and its
border.
6. You would use a negative margin if you wanted to make two elements
overlap.
Block an Inline
• Block elements will appear on the page stacked on top of each other.
(Each will be on a new line)
• Inline elements appear in line with whatever elements they are placed
beside.
• Inline-block elements behave like inline elements, but with block-style
padding and margin.
• Div is a block-level element. It is used as a container element to group
other elements. Allows you to divide the page into different blocks and
apply styling to those blocks.
• Span is an inline-level element. It can be used to group text content and
inline elements for styling.
• https://developer.mozilla.org/en-
US/docs/Learn/CSS/CSS_layout/Normal_Flow
• https://www.w3schools.com/html/html_blocks.asp
• https://www.digitalocean.com/community/tutorials/css-display-inline-
vs-inline-block
• https://github.com/JoshuaBilsland/css-exercises
Knowledge Check Answers
1. Block elements will appear on a new line whereas inline elements will
appear on the same line.
2. An inline-block element stays on the same line, but the width and height
of the block is still respected.
3. A h1 element is a block element.
4. A button element is an inline element.
5. A div element is a block element.
6. A span element is a an inline element.
Foundations - Flexbox
Introduction to Flexbox
• Relatively new of manipulating elements in CSS. Already a common way
of positioning elements for many developers.
• Flexbox is a way to arrange items into rows or columns. The items will
then flex (grow or shrink) based on defined rules.
• A flex container is any element that has a “display: flex” attribute on it.
• A flex item is an element that lives directly inside of a flex container.
• Flex containers and items (along with nesting) is the primary way to
build up complex layouts of elements. For example…
• https://www.internetingishard.com/html-and-css/flexbox/
Knowledge Check Answers
1. A flex container is an element that contains the attribute “display: flex”.
An item is an element that goes within a container.
2. A flex item is created by making it part of a flex container class (using the
class attribute). In your CSS file, you would give different CSS rules to
determine how those elements should look within the container.
Axes
• Flexbox can be used horizontally or vertically. By default it is horizontal
(“row”), but can be made to vertical using “column”. In CSS you would
write “flex-direction: column;”
• Containers have two axes: the main axis and the cross axis. The direction
of the axes changes depending on the direction being used. If “row is
being used, the main axis goes left-to-right. If “column” in being used, it
will go top-to-bottom. The cross axis is the opposite one that is no longer
the main axis.
• One thing to note, “flex-direction: column” would not work as expected
if the shorthand “flex: 1” is being used. This is because it sets flex-basis
to 0 which means that flex-grow and shrink would start their calculations
at 0. By default, empty divs have 0 height, so the flex items do not need
any height to fill up the height of their container.
Knowledge Check Answers
1. “flex-direction: column”
2. In a column flex-container, flex-basis refers to height
3. In a row flex-container, flex-basis refers to width
4. In a column flex-container, the main axis goes top-to-bottom. The
items will be placed on this main axis as so height determines how
much of this axis it takes up. Width is used for row flex-container
because the main axis goes left-to-right. It is all relevant to where the
main axis is.