Web Development: Part 1 - Session 3

Templates

Basics, Practice, Github, and Templates

Get Started Now

Do Now

Use this starter code and do your best to get this result:

XS: 1 x 6

SM: 2 x 3

MD: 3 x 2

LG: 6 x 1

Use a container for everything
Don’t forget to start with a row!
You don’t need to specify xs, only sm/md/lg
Apply some CSS to .staff, and some to .fa-user-circle
.staff: lightblue background color, some padding, margin, font-size, and center
.fa-user-circle: font-size and margin

Ready for more?

You got this.

HTML & CSS Basics

Try some sections on w3schools

Make sure you try the exercises at the bottom!


HTML: Forms




CSS: Layout




Bootstrap Practice

Try making something with the following components:


Github

Git

Version Control

Think of it like a "photographer" that takes "snapshots" of your code.

This allows you to track changes, revert to previous code, and more!

Github

Cloud storage + collaboration

Push your changes to the cloud and see the differences visually.

Collaborate by pushing & pulling changes without stepping on each others' toes.


Concept Explanation Photographer analogy Syntax (command line)
Initialize Turns a folder into a Git repository "Hires" the Git photographer git init
Add Adds certain files/folders to the staging area to be committed Puts "people" in the "frame" of a photo git add . (to add everything)
git add filename.html (to add one thing)
git add --all (to also include deleted/renamed files)
Commit Saves the files that were added to the stage Photographer takes the photo git commit -m "this what I did since the last commit" (except present tense)
Remote Connect the cloud repository to your local repo Pick a photo album to send your pictures to git remote add origin URL
Push Send your local commits to the cloud repository Send photos to a photo album git push -u origin master (the first time)
git push (the rest of the times)
Pull Pull in any changes from your remote to your local repo Save photos in the album to your local collection git pull
Revert Undo a commit Undo that horrible haircut you regret git revert c2e68ee36cc3b6ecb0249743f1b97fdfd0fc02a9 (this is your unique commit identifier)

Local

  1. Install Sublime or Atom.
  2. Install Github Desktop.
  3. Follow this guide to get signed in.
  4. This tutorial will walk you through the process of adding, committing, and pushing.

Cloud

  1. Sign up for a Codeanywhere account using your Github
    • Check your email to verify your account.
  2. Create a new container
    • Name: anything (name username, HTML, etc)
    • Stack: HTML (Ubuntu)
    • Enable Always On: only works for paid accounts
  3. We logged in to Codeanywhere with Github, but we still need to authorize Codeanywhere to push your code to Github!
    1. Go to your dashboard
    2. In the left sidebar, click SSH keys
    3. Select & copy the entire SSH key
    4. Back on Github, go to your profile settings > SSH and GPG keys
    5. Add a New SSH key
    6. Title: Codeanywhere
    7. Key: Paste!
  4. Navigate to your command line in Codeanywhere
  5. Let's run some commands. Again, you may want to come back later and familiarize yourself with some of these commands later.
    1. mkdir first-repo makes a new directory
    2. cd first-repo goes into that new directory
    3. git init turns the folder into a repo (hires git)
    4. touch index.html makes a new file
    5. Right-click on your Connection in the left sidebar and press Refresh
    6. Expand first-repo and open index.html
    7. Paste in some starter code from HTMLshell and add whatever code you want
    8. SAVE!
    9. git status to see that this file has been edited (it's in red)
    10. git add index.html to add the file to stage, ready to be committed
    11. git status to see that the file is on the stage (it's in green)
    12. git commit -m "start index" to take a "snapshot" of your file (use whatever message you want)
  6. Now we need to make a home for the repo on Github so that we can push!
    1. Go to Github and press + to make a new repository
    2. Give it the same name: first-repo and press Create repository
    3. Make sure you select SSH at the top
    4. Copy/paste the code that says git remote add origin URL
    5. Copy/paste the code that says git push -u origin master
  7. In the future, you can continue to:
    1. edit
    2. git add index.html (or git add . to add everything)
    3. git commit -m "message"
    4. git push (after you push the first time, you no longer need to include the -u origin master)

Github Pages

Host your code on Github without any "remix" button.

  • Make sure you have a repository on Github.
  • Go into the Settings ⚙️
  • Scroll down to the Github Pages section
  • Change the Source to the master branch and press save
username.github.io/reponame
  • NOTE 1: Your page may take up to a few minutes to show up at the URL.
  • NOTE 2: If your page isn't named index.html, then add it to the end of the URL
    • i.e. username.github.io/reponame/home.html

Bootstrap Templates

Start with a free bootstrap template


Tips

  • Use Find to look for colors and filenames to replace
  • Inspect Element to determine colors, class names, and more!
  • Using a Mac? Try the Digital Color Meter and rgb2hex.


Micro Feedback

Live Q&A