To create a web site, we use a couple basic things - HTML, CSS, and JavaScript. We’ll use a special editor in the browser that will save our work so we can work on our projects from home, the library, or school!
- Parents: Please take our anonymous survey.
- Install Google Chrome at www.google.com/chrome - this is our preferred browser to work in.
- If your daughter doesn’t have a Gmail account, set her up with one. (It’s ok to say she’s 14 on their age restriction piece)
- Be sure to write down your username and password on the account reminder worksheet!
- Create an account on https://github.com
- Be sure to write down your username and password on the account reminder worksheet!
- Check your email for a GitHub verification email.
- Sign up for a Codeanywhere account on https://codeanywhere.com
- Make sure you use your Gmail account when you register.
- Check your email for a Codeanywhere verification email.
- Log into Github.
- Go to https://github.com/kansascitywomenintechnology/codingandcupcakes and hit the fork button in the top right.
- Log into Codeanywhere.
- In the Codeanywhere editor, select File -> New Connection -> GitHub.
- Click Connect your GitHub account, enter your GitHub account details, and click Authorize application.
- You may need to disable your browser's pop-up blocker. To do so, click on the pop-up blocker icon at the far right of your browser's address bar and select "Always allow pop-ups from codeanywhere.com"
- Select your codingandcupcakes repository and click Next.
- The application may take up to 45 seconds to copy the repository. When it's finished, you should see a list of files in the left sidebar of the editor screen.
Note: If you have trouble getting steps 4-6 to work, try the following alternative method:
- In the Codeanywhere editor, select File -> New Connection -> Git from URL.
- In the dialog box that appears, paste the URL of your Coding and Cupcakes GitHub repository: https://github.com/{your GitHub username}/codingandcupcakes, and click Next.
- For name, type codingandcupcakes. Select either of the HTML options from the list of development stacks and then click Create.
Refer to the screenshot below for steps 7 & 8.
- In Codeanywhere, click index.html to open it. This is the code behind the main page of your website.
- Click the File Preview icon (the magnifying glass). This will open the main page of your website in a new tab.
Tip: As you make updates on your website, be sure to save frequently in Codeanywhere (shortcut command is CTRL + s on Windows; Command + s on Mac) and refresh your browser (F5 on Windows; Command + R on Mac). This allows you to see changes made to the website immediately.
Start looking for code to change in your index.html file to customize and make it your own. All of the code is written within HTML tags contained in < >
symbols. You’ll be changing code within the brackets. We will point out specifics tags for you to personalize with information about your cupcake shop. For example, <title>You’ll change code here.</title>
Make sure to not delete any closing tags or classes! Hint: Codeanywhere's colors will change if your code is broken!
- Change the title of your site to {your name}'s cupcake shop.
- Change the h1 tag of the website to {your name}'s cupcake shop.
- Add your own text about your cupcake shop using h2, h3, and p tags. Get creative in telling your story!
- Put in an image of your cupcakes on the page. (Look in the img/cupcakes folder for some recommendations. Don't see any you like? Search cupcake images on Google or Flickr.)
- Hint: Images are stored between lists tags (
<li>
and</li>
) in the code. Find these tags and replace the content so that it points to your images.
- Hint: Images are stored between lists tags (
The easiest way to add another page to your website is to copy an existing page and then make changes to it.
- In Codeanywhere, right-click on index.html in the list of files and select Clone. Name the new file contact.html and then open it. It should be empty.
- Copy all the code from index.html into the new file.
Next, you'll modify the content of the page. Let’s put the shop’s address so people know where to visit your store.
- Look in the body section of the code for the
<div class=”content”>
section (approx. line 24 of the code). - In the content section of your contact page, add contact information between the
<h1>
and</h1>
tags.-
Use paragraph tags to insert your contact information, and anything else you want to say. Note: It’s okay to erase the content between those tags.
-
You can use the Code Koalas address:
<h2>Visit us at:</h2> <p>Code Koalas</p> <p>1712 Main Street, #100</p> <p>Kansas City, MO 64108</p>
-
Now let's modify the navigation, which lets us know where we are on the website. You can see how the navigation works by going to your website and clicking between the Home and Shop tabs in the header. Notice the gray shading and pink bar that highlight each tab as you click between them. We want to make the same thing happen when you click on the Contact page.
- Find the
class="selected"
code in index.html. Notice that it's on the line withhref="index.html"
. If you open the shop.html file and findclass="selected"
, you'll notice that it's on the line withhref="shop.html"
. This is how the code controls which navigation tab is highlighted in pink. - In the contact.html page, move
class="selected"
to the line withhref="contact.html"
. This way, the Contact tab will be highlighted when we're on the Contact page.
Next we are going to add a form onto the Contact page, allowing people to email us with questions or comments. Again, the easiest way is to start with some existing code and then make our changes to it.
- This link has an example you can customize: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail
- Once you’ve customized the form in the link above, copy the tags and code of the h2 and form sections.
- In the contact.html file in Codeanywhere, after the paragraph tags you added for the Visit us at section, paste the copied h2 and form code over the existing h2, p and
<ul> </ul>
tags.
- Open the shop.html file.
- Use the list item tags to add more cupcake flavors to the one already there.
- Be sure to include a photo! (Hint: Search Google or Flickr for cupcake images.)
- Create a new file called style.css
- Look in index.html to see how the the mystyle.css page is linked in code. (Hint: Look for the
link rel=”stylesheet”
line of code) - Add a line of code below the mystyle.css line of code. (Hint: copy the line of code, paste it below and modify it to point to your newly created style.css file.)
- You are going to be customizing the css in the style.css file, which currently is only working on the index.html page. If you want this customization to apply to the other Shop and Contact pages of your website, you should insert the line of
link rel=”stylesheet”
code that points to your style.css file onto the Shop and Contact pages too.
- You are going to be customizing the css in the style.css file, which currently is only working on the index.html page. If you want this customization to apply to the other Shop and Contact pages of your website, you should insert the line of
- Open the style.css file in Codeanywhere.
- Change your background color. See example here: http://www.w3schools.com/css/css_background.asp
- Change the background of the header and content as well. Want inspiration for a cool color palette? See example here: https://color.adobe.com/explore/most-popular/?time=all
- Choose a font from Google Fonts and add it to your html page, then call it in your styles. Check out the Google Fonts at fonts.google.com
- Open an SSH terminal in Codeanywhere by right-clicking on codingandcupcakes in the left sidebar and selecting SSH Terminal. When the terminal window opens, type the following bolded Git commands:
- git status - shows changes you've made to files on your local computer
- git add --all - adds files to the batch, kind of like adding ingredients to cupcake batter
- git status - the changes should show in green now instead of red
- git commit -m "{your message here}" - commits files with a message about what you changed
- git push origin master - pushes the changes to your branch in GitHub
- git push origin master:gh-pages - creates a page where your repository is hosted. Mine is http://ajander.github.io/codingandcupcakes
Note: You only need to type the git push origin master:gh-pages command once when you initially publish your website. If you make updates to your website at home and want to publish the changes, you can stop after git push origin master.
Did you love working with code? If you want to learn more on your own, we have suggestions for you.
- Create an account on http://www.codecademy.com/
- Complete this course on Codecademy: http://www.codecademy.com/courses/web-beginner-en-zmn0b/0/1?content_from=make-an-interactive-website%3Ayour-first-program