HTML Lab
In this lab you will explore how to create simple HTML pages and link them together. (These pages will be ugly but functional. Next week we start making them pretty.) Be sure to do the reading / viewing for this week before working through the lab.
Lab Objectives
By the end of this lab, students will be able to...
- Identify common key sections of web page by careful reading of an HTML document.
- Use a HTML template web page to quickly create a new HTML web page.
- Create several sample HTML pages, adding proper titles, headings, and links, and save them appropriately
- Link correctly to pages in the same directory or in different directories.
Directions to Build The Simplest Web Page Ever
- Create a new folder on your computer called HTML_lab. Save all files from this lab into this folder.
- Open a new document in your text editor, either Brackets (recommended), Dreamweaver, Notepad++ or Komodo Edit (ask me if you wish to use another particular editor)
- Type
(or copy and paste from here to the text editor)
<!DOCTYPE html> <html> <head><title>Simplest HTML page</title></head> <body>Hello Everybody</body> </html>
- Save the file as simple.html
- View the file in a web browser
Using an HTML Template
The above example represents an extremely simple HTML page, but its not quite complete and its not up to current web standards (it won't validate) which will make your web pages compatible with future browsers.
- Open a new document in your editor, either Brackets (recommended), NotePad++ or Dreamweaver (all available on campus) or get one of the following for use at home:Brackets (recommended), Notepad++, Komodo Edit>, Sublime Text, Atom, or (ask me if you wish to use another text editor)
- Type (or copy and paste from here to the text editor)
<!DOCTYPE html><html lang="en">
<head>
<title>HTML Template</title>
<meta charset="utf-8" />
<meta name= "author" content="yourname" /></head>
<body>
<h1>Page Heading</h1>
<p>Page Content </p>
</body>
</html>
You can see this page has the <html>, <head>, <title> and <body> elements, but includes some additional information for the web browsers.
- Edit the text to include your name in the <meta> tag content showing as yourname above.
- Save this file as template.html
- View the file in a web browser.
Create several pages Using the Template, Link Them Together
- Open the template.html document in your text editor
- Use Save As to make a copy of the template file as a new file a called spring.html
- Edit the contents to so that its <title> tag reads <title>Spring</title> and its <body> tag reads
<body> <h1>Spring Here</h1> <p>Can't wait till <a href="summer.html">summer</a>!</p> </body>
- View the file in a web browser
- Notice the link? If you click on the link you should get an error message, since you haven't made the summer.html page
- Create the summer.html page by repeating steps 1-3, using summer words in the <p> tag and for the title and h1 tag, and changing the <a> tag to link to href="spring.html" .
- View the file in a web browser.
- Click the links one each page to move from one to the other and back. If you still get an error message be sure the files are both saved in the same directory, double check your code, and the file names for correct spelling and punctuation (all lowercase). Details are important!
Link to pages in other directories
You may want to review the information about linking before completing this part of the lab.
Create two folders one called blue and one called red
- Use the HTML template file to save six different documents with the given names, sunshine.html, rain.html, moon.html, stars.html, day.html, night.html into the folders as shown. Note that sunshine.html and rain.html are not in either folder.
- Edit each file with an appropriate Title (<title>) and header (<h1>) as done in part 3 above.
- Create five links in each document that connect it to each of the other documents. Use an unordered list <ul> and a link tag <a>. For example the body of the rain.html page you would look like
<body> <h1>Rain</h1> <ul> <li><a href="sunshine.html">sunshine</a></li> <li><a href="red/day.html">day</a></li> <li><a href="red/night.html">night</a></li> <li><a href="blue/moon.html">moon</a></li> <li><a href="blue/stars.html">stars</a></li> </ul> </body>
- Test your pages links on your local system before uploading to
the FTP site. Just open your any of your pages in a browser and systematically click
through the links looking for errors. Your pages should look like
Upload the completed lab to your course portfolio
- Upload your spring.html and summer.html using sFTP to your folder on the web server
- View your pages at http://studentfolders.cascadia.edu/bit112/
- Validate each page after you upload it by copying and pasting the URL into http://validator.w3.org/
- Correct any issues on your local computer, then upload the files and validate again.
- Contact me by email me or visit the FTP lab this week if there is a problem that you do not know how to solve.