Return to course home

Install Atom.

If you want to be a proper web developer, then you should be using a proper text editor - not Notepad and not TextEdit.

Atom is a “hackable” text editor for the 21st Century, and it is the text editor of choice not only for us, but for many computer programmers all over the world.

Let’s check if you have Atom already installed on your computer.

For Windows:

  1. Click the search button in the bottom-left of the menu bar.
  2. Enter “Atom”.
  3. If you have Atom installed, then you should be able to see a green atom icon. That’s Atom! windows-atom
  4. If you do not have Atom installed, then you should not be able to find this green atom icon. From here, you will have to download it using the link below.

For Mac:

  1. Click the magnifying glass in the upper-right corner, or press Command + SPACE.
  2. Enter “Atom”.
  3. If you have Atom installed, then you should be able to see a green atom icon. That’s Atom! mac-atom
  4. If you do not have Atom installed, then you should not be able to find this green atom icon. From here, you will have to download it using the link below.

Please click here to download the Atom installer.

Once we have Atom installed, let’s continue learning!

Recap from last time

Some of you may be confused after speeding through the first two lessons of our build-a-website program. To assist in your learning, here is a summary of what you learned:

Git

Git is a system that keeps a history of any changes to files - it can help you determine exactly what files changed, when they were changed, who changed them, and the reasons why they were changed.

There are a bunch of uses for Git, such as:

For the purpose of our program, you will be using Git to commit (or highlight) any changes we make to your website to your local repository (the folder that is on your computer), then to push those changes from your local respository to your remote GitHub repository (copying your files from your computer folder to the folder on GitHub)

Repository

A Git repository is actually the .git/ folder inside your project area (which is the folder that contains all the files for your website). This repository tracks all changes made to the files in your project, thus building a history over time. This means that if you delete the .git/ folder, then you lose your entire history of changes (so please don’t delete the .git/ file).

For the sake of this program’s simplicity, when you hear the term “commit”, think of it as the process of writing down your current file changes to a growing list of file changes - this growing list is your Git repository, thus you “commit” your current files into the repository. Likewise, when you hear the term “push”, think of it as copying your current files and its change history to your online GitHub folder, thus you would “push” everything in your .git/ folder to your online GitHub repository.

You might also hear the term “fetch” which means to download commits, files, and refs from a remote (or online) repository into your local repository (the folder on your computer). You will probably only use this command if you end up switching computers from your previous computer, and you need to download your website files to this new computer.

GitHub

Github is a website that helps us developers store and manage our code. Google search results can give us more insight into what Github is. Some features that Github provide for developers make it really easy for us to do pretty cool things, like using Git commands without knowing any command line interface or have our own website hosted online for free!

For this purpose of this program, GitHub will be holding your online repository in which you push your project changes to.

GitHub Desktop

GitHub Desktop makes it easy for us to do many of the common Git command with the click of a few buttons! For most of this program, you will be using GitHub Desktop to commit and push your website changes to your online GitHub repository!

GitHub Pages

GitHub has a really awesome feature where you can host your own website FOR FREE! All you need to do is create a repository named [your username here].github.io and it’ll automatically host your website at [your username].github.io. It is pretty nifty, and it doesn’t cost a dime!

You will be hosting your website using GitHub Pages, and this webpage is automatically set-up through the repository name ([your username here].github.io)!

index.html

The index.html page is the most common name used for the default page shown on your website if no other page is specified when a visitor visits your website. In other words, index.html is the name used for the homepage of your website.

Last time, we made you create and edit an index.html file that is placed into your [username].github.io repository (both local and online). For the start of this program, if you want to make any changes to your preliminary website, then you will make those respective changes to the index.html file.

HTML

Hopefully you have an idea of what is going on so far with this program. Hence, to start the foundation of your website, we will be teaching you how to learn and use HTML!

What is HTML?

HTML stands for Hypertext Markup Language. HTML describes the basic structure of a web page semantically. In other words, it conveys how to render the graphics of a web page to the browser. For this lesson, the browser will read your code inside the index.html, and your browser will begin to have a basic structure to it!

triad

Learning HTML is the first step in creating websites, combined with JavaScript and CSS you will be able to create aesthetically pleasing and functional websites. JavaScript and CSS is something that can be learned at another time. For now, let’s focus on how to add basic content on a page, like text and images!

HTML: Basics

Anatomy

Every HTML element is comprised of:

triad

Essential HTML Elements

PRE-CHALLENGE #01: Do you have an index.html?

We mentioned an index.html file earlier - but do you actually know if you have that file for your website?

Let’s go ahead and search for our index.html file.

For Windows:

  1. Click the search button in the bottom-left of the menu bar.
  2. Enter “File Explorer”, then click it. windows-index
  3. Click on Documents -> GitHub -> [username].github.io. This should lead you to your website folder. Inside the folder, you might have a README.md, an index.html, or perhaps nothing at all. If you DO have an index.html, then you are set! Otherwise, if you DO NOT have an index.html, then go to step 4. For example, my folder looks like this: windows-index Since I do not have an index.html, I will need to add it.
  4. To add an index.html file to your folder, please right-click the link here and select Save as....
  5. Go ahead and save the index.html file to location of your website folder (e.g. Documents -> GitHub -> [username].github.io). windows-index
  6. Your website folder should look like this now: windows-index
  7. Go ahead and open this website folder in Atom by opening up Atom, click File -> Add Project Folder..., then navigate to your project folder (e.g. Documents -> GitHub -> [username].github.io) windows-index windows-index
  8. You should see your project folder on the left column of your Atom! Double-click your index.html to edit it!
    windows-index

For Mac:

    1. Click the magnifying glass in the upper-right corner, or press Command + SPACE.
  1. Enter “Finder”, then click it. mac-index
  2. Click on Documents -> GitHub -> [username].github.io. This should lead you to your website folder. Inside the folder, you might have a README.md, an index.html, or perhaps nothing at all. If you DO have an index.html, then you are set! Otherwise, if you DO NOT have an index.html, then go to step 4. For example, my folder looks like this: mac-index Since I do not have an index.html, I will need to add it.
  3. To add an index.html file to your folder, please right-click the link here and select Save as....
  4. Go ahead and save the index.html file to location of your website folder (e.g. Documents -> GitHub -> [username].github.io). mac-index
  5. Your website folder should look like this now: mac-index
  6. Go ahead and open this website folder in Atom by opening up Atom, click File -> Add Project Folder..., then navigate to your project folder (e.g. Documents -> GitHub -> [username].github.io) mac-index mac-index
  7. You should see your project folder on the left column of your Atom! Double-click your index.html to edit it!
    mac-index

CHALLENGE #01: The beginnings!

Let’s try adding these three HTML elements to your website! Go ahead and clear our your index.html file, then edit your index.html file so that you insert these items:

Here are some hints to remember:

Here are some steps to get you started:

  1. Once you open up your index.html, let’s go ahead and place a large heading element for our name. We will use <h1> as our heading size.
    challenge01
  2. Since this large heading element will say “Name”, we will put “Name” in between the <h1>.
    challenge01
  3. Next, we will have a paragraph that will say our name. The paragraph element is <p>. For example, my name is Benson Budiman, so I will put “Benson Budiman”.
    challenge01
  4. Let’s go ahead and place a smaller heading element that says “Description”. We will use <h4> as our heading size.
    challenge01
  5. Next, we will have a paragraph that will say a short description about me. The paragraph element is <p>. For example, I am a UCSD student, so I will put that “I am a UCSD student.”
    challenge01
  6. Finally, we will have an anchor element that says “Click me!” that redirects the user to my GitHub profile. Make sure to replace the link with your own profile link!
    challenge01

Here is an example of a small website that includes these three HTML elements:

challenge01

More Essential HTML Elements

CHALLENGE #02: Let’s add a little more!

Let’s try adding more three HTML elements to your website! Go ahead and edit your index.html file so that you insert these items to the bottom of what you currently have:

Here are some hints to remember:

Here are some steps to get you started:

  1. Once you open up your index.html, let’s go ahead and place that button that says “Click me!”. challenge02
  2. Let’s place an image of a dog! Here is an image of a dog that you can use. Go ahead and click Here, and then use its URL link for your dog image! challenge02
  3. Let’s place an image of a cat! Here is an image of a cat that you can use. Go ahead and click Here, and then use its URL link for your cat image! challenge02
  4. Let’s put two line breaks between the paragraph element of your name and the heading element of “Description”. challenge02
  5. Let’s put the final three line breaks - one line break between the anchor element and the button element, one line break between the button element and the image element of a dog, and one line break between the image element of a dog and the image element of a cat. challenge02

Here is an example of a small website that includes these added HTML elements:

challenge02

Slightly more complex Elements

Ex:
<ol>
  <li> This </li>
  <li> is </li>
  <li> an </li>
  <li> ordered </li>
  <li> list. </li>
</ol>

Output:

1) This

2) is

3) an

4) ordered

5) list.


Ex:
<table>
  <tr>
    <th> Table Heading1 </th>
    <th> Table Heading2 </th>
  </tr>
  <tr>
    <td> Table Data1 </td>
    <td> Table Data2 </td>
  </tr>
  <tr>
    <td> Table Data1 </td>
    <td> Table Data2 </td>
  </tr>
</table>

Output:

triad

SO MANY TAGS!! Let’s examine them one by one:

How to set up a proper HTML file

Professional HTML files have much more than just a body element containing the different HTML elements. They have an element hierarchy and most important of all they contain metadata (data about data) that tells the browser how to display your web page.

Hierarchy

Ex:
boiler_plate

Metadata

The following HTML metadata elements should be declared inside the head element.

metadata

CHALLENGE #03: The finishing touch!

Here is the final challenge. Go ahead and edit your index.html file so that you insert these items to the bottom of what you currently have:

Here are some hints to remember:

Here are some steps to get you started:

  1. Let’s first add the proper metadata to your index.html. Using the image below, you will want to copy the lines where there are red arrows. The lines without red arrows should be already written from the challenges above, and so those lines should be placed within a <body> tag. Make sure your code looks similar in formatting to the image below: challenge03
  2. Next, let’s begin to make our unordered list of favorite foods. We will start by adding the <ul> tags to our index.html. challenge03
  3. My favorite foods are sushi, pizza, and Hot Pockets. I will add my favorite foods as a list item using <li>. You should add your own favorite foods - add as many (or as little) as you would like! challenge03
  4. Don’t forget to say that this is your list of favorite foods! challenge03
  5. Let’s start making a table of my friends and their GitHub username! Let’s first create a <table>. Then, place a <tr> (table row) inside the <table> and insert two <th> (table headers) - My friends, and GitHub username. challenge03
  6. Ask some of your friends (or the people next to you) for their name and their GitHub username! Let’s say I have Wesley Chen as my friend, and his GitHub username is wes-chen, and I have another friend named Jason Cabrera with his GitHub username being jayrc7. For Wesley Chen, I would add another <tr> (table row), then place two <td> for his name and his GitHub username. Likewise, I would do the same for Jason Cabrera. Feel free to add as many friends as you would like! challenge03

Here is an example of what that includes these added HTML elements look like:

challenge03

Final Remarks

Here is an example of more things you could put on your website!

Codecademy does a pretty good job of teaching HTML. Run through this HTML tutorial to learn more.

Next Lesson

For next lesson, we learn about CSS, a styling language used to help our HTML look better. If you would like to get ahead, then please run through this Codecademy tutorial at your own pace before the next lesson.

Return to course home