October 20, 2017 Meeting

Welcome Back! Let’s get down to it!

This week we are going to:

  1. Quickly introduce and catch up anyone who is new this week – WELCOME!
  2. Make sure everyone has the following:
    1. GitHub Account
    2. Cloud9 Account with our team
    3. Forked the HTML5, CSS and JS book repo at github
    4. Created a new workspace with the github repo in Cloud9
  3. Let’s add a home page for our site – kind of like this: https://youtu.be/ent9dh0dRJg
    1. Add “index.html” in cloud 9 and type in a bit of html (we will talk about this in a bit)
    2. git add .
    3. git commit -m “added index.html”
    4. git push
  4. Enable GitHub Pages in settings (it is probably turned off by default)
  5. Copy the URL in your GitHub settings for your website, once you push your changes, your site is published there! Whoot!
  6. Now let’s add
    1. A title for our index page <title>This is my really great page</title>
    2. A header <H1>This is my really great header</H1>
    3. An image <img src=”myImage.jpeg” alt”really great image”/>
      1. Make a new folder called “images”
      2. Find a great image online somewhere and save as to your desktop
      3. File -> upload local files in Cloud9
      4. push again to git
        1. git commit -a -m “my note”
        2. git push
    4. What happened? Didn’t work quite right? Let’s TROUBLESHOOT!
      1. Can we see what is going on by using F12 developer tools in Chrome?
      2. Can we see if everything got up to git the way we wanted? Check out our git hub repo online.
      3. Use Ctrl+F5 to do a forced refresh of your browser
    5. BONUS: If we have time, check out https://www.favicon-generator.org/
      1. Make a favicon
      2. Add it to the root of your website
      3. Add two lines to your header
      4. Commit, push and check out your site!
  7. Awesome! Share your site URL on Slack so we can all see it!

 

Advertisements

Bootstrap & Web Site Structure

What is Bootstrap?

“Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first web sites.” – From W3Schools Bootstrap Tutorial

Why Use It?

  • Responsive Web Design: lots of built-in (“out of the box”) features to ensure that your site looks good across all types/sizes of devices
  • NavBar: Beautiful menus!
  • Consistent look and feel: buttons, menus, headings, lists, and many other Web page components
  • Themes: Many lovely themes available to change the colors and other aspects of appearance just by swapping out a file! See Bootswatch for a nice selection of free downloadable themes
  • Grow your Developer Skillset: the skillset we want to build here isn’t Bootstrap per se, but rather the ability to incorporate a third-party framework into a project, and an understanding of how the pieces fit together within the project structure. While Bootstrap isn’t a required tool for all development projects, it is a common and very useful one. There are many, many, many JavaScript and CSS libraries out there and even before you start writing your own JavaScript code you can and should understand how to install and use these tools.

How Do I Get Bootstrap Into My Project?

  • Prepare your directory structure: Bootstrap includes files for scripts (JavaScript), fonts, and CSS and we need to organize these files within our site. We will follow the common convention of creating separate directories for CSS, Scripts, Images, and Fonts.
    • Open your Web project in Atom: make sure you are in your site’s main Project Folder (FilmFestivalSite in below example).
    • Add project folders: right-click on your project folder in Atom and choose “New Folder” to create folders named css, fonts, images, and scripts.

DirectoryStructure

  • Get Bootstrap
    • Download: Go to http://getbootstrap.com/getting-started/#download. Click the Download Bootstrap button. That will download a file named bootstrap-3.3.6-dist.zip to your computer.
    • Unzip the files: On Windows machines you will find the zip in your Downloads directory, right-click and choose “Extract All”. You can change the destination folder if you like before hitting the “Extract” button, but be sure you know where the files are.
    • Copy the files to the folders in your Web project: the extracted files are organized into css, fonts, and js folders below the bootstrap-3.3.6-dist folder. Copy to the matching folders in your Web project: css to css, fonts to fonts, and “js” to “scripts”. Hint: In Atom you can right-click on a folder and select “Show in Explorer” (Windows) or “Show in Finder” (Mac) to open your destination folder to set up the copy with side-by-side windows.
  • Get JQuery:
    • Note: Version as of this writing is 1.12.3; get the latest 1.x.x version
    • Download JQuery: https://jquery.com/download/. Under the JQuery 1.x section right-click on “Download the uncompressed development jQuery 1.12.3” and choose “save link as”.  Save the file as  jquery-1.12.3.js
    • Copy the JQuery file to your project: copy jquery-1.12.3.js to the “scripts” folder of your project
    • Note on Uncompressed vs. Min versions of JQuery:  JQuery can be downloaded in its uncompressed form as above or in a “minimized” form jquery-1.12.3.min.js. The min version is much more efficient for use on your Web Page. For user-friendly pages it is important to minimize page load time and the size of scripts so in “Production” we would always deploy the “min” version of both CSS and JavaScript files. However, for development we want to be able to read, understand, and learn from the CSS and script files so we use the uncompressed (non-“min”) versions in our development environment.

Our First Bootstrap Page:

  • Add a new HTML file named “BootstrapSample.html” to your Web site’s main folder.
  • Copy content from our “Bootstrap Sample Page” to experience the power of Bootstrap right away. Once everyone has it running in your environment we can explain some of the opportunities for you to customize it and make it your own. This one is put together from combining elements of sample templates on the Bootstrap site
  • The one change you will need to make is highlighted: that is the anchor <a> tag for one of the menu links; in my example it links to a page named “FilmDetails.html”. Change it to link to your own page.

Deployment Considerations:

Once you have your page working in your own environment if you want to upload it to your Web site on the server you need to ensure that the folder structure and files needed for Bootstrap and JQuery are uploaded as well. In ATOM you can select your css folder for upload to copy the folder and its contents; do the same with your scripts, fonts, and images folders.


 

Web Page Basics 2: Responsive Design

Responsive Web Design: You will want your Web page to look good on all Browsers and devices including tablets and phones. This is where Responsive Web Design comes in. Before adding more content to our base page, let’s design the overall layout to be Responsive.

Do Not: Use the Table tag to force your page’s elements to fit into an overall page layout; a Table will not wrap or stack to fit onto a small screen.

Instead:

  • Create areas on the page using the Div tag. “Divs” that appear next to each other on a full-size computer screen can stack vertically when the screen is scaled down on a phone
  • Use a responsive grid layout; this divides the page into rows and columns using divs rather than tables. There are some excellent frameworks, such as Bootstrap, available that make this easy with many advanced features to make your site responsive as well as beautiful. We will be looking at examples of this in one of our future meetings.
  • For your first Web page start with using divs and we will work our way towards the responsive grids.

Do Not: Use fixed-width pages or fixed-width elements 

Instead:

  • Use percentages to define width: examples: width:100%;  or max-width:300px; or max-width:100%;  
  • Set the Viewport to scale to the device: the viewport is the area of the page visible on the user’s device screen.  Adding the following “meta” tag inside the <head> of the page tells the Browser to scale to the device rather than just shrinking everything  to a tiny font size to show the full page view :

<meta name=“viewport” content=“width=device-width, initial-scale=1.0”>

  • In the CSS define separate styles for large and small screens when appropriate; these are called “media queries” in the CSS. Not needed for every element but can just what your page needs sometimes to address problem areas with the display across devices.

See W3C Tutorial for more on responsive Web Design

 

Web Page Basics 1 – Starter Page

Over the last few weeks we have been learning about the basic building blocks for Web pages using HTML and CSS to create our own pages. This series of Blog posts will review the concepts implemented so far.

Create a basic HTML page in a text editor; save the file with an .html extension.

  • Start with the document type declaration !DOCTYPE html; this tells the Browser what type of content to expect
  • The Web page is an HTML document and is structured using paired (opening and closing) HTML tags; tag names are enclosed in “angle” brackets; closing tag starts with </
  • Begin structuring the page by adding HTML starting and closing tags: <html></html>
  • Add the <head></head> tags just below the starting <html> tag; head content is not displayed, but contains information about the page, including title, links, styles, and “meta” tags used for Search Engine Optimization (SEO)
  • Add the <title></title tags inside the <head>; type your page’s title between the tags. The title will display on the tab in the Browser when you view the page.
  • Add the <body></body> tags below closing </head> tag . The only content that will be visible on your page is the content that you create inside the body.
  • Add some content in the body: a simple thing to add is a heading using the <h1></h1> tag pair and/or a paragraph using the <p></p> tags
  • Save the .html file;  view it in your Browser. Your document should look something like this:

<!DOCTYPE html>

<html>

<head>

  <title>My Web Page</title>

</head>

<body>

    <h1>Hello World!</h1>

    <p>Come back later for much more interesting content!</p>

</body>

</html>