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