Goals
Learn...
- How to format tabular data into tables
- About the importance of nesting in HTML tables
- How to created basic input forms
- About the importance of attributes in HTML forms
Key Concept
HTML tables are used to format tabular data and should not be used to create
page layouts. When tables are properly formatted, programs and applications can
more easily parse and extract correct information from the table. HTML
forms are used to create user interfaces. When forms elements are
appropriately labeled using name and id, applications
can easily extract submitted information.
Pre-lab
Pre-lab Reading
Pre-lab Activity
- exercise 8-1
- exercise 8-2
- exercise 8-3
Use reading and activity to answer the Pre-lab Questions. Be sure to complete the activity and answer the pre-lab questions in Blackboard before the start of the lab period.
In-lab
Preparation
- Always make sure you save your lab file in the appropriate folder, i.e.,
lab4.
- For file names, only use lowercase letter and never use spaces.
It is very important to read the pages as you do the exercises. While you may be tempted to download the solution without doing the reading and actual exercises, the purpose of this work is to learn concepts and details that you will need to know to complete the rest of the lab and to answer exam questions.
1. HTML Tables
- Use pages 133-144 as a reference and complete exercise 8-4 on page 145 using Notepad++.
- Remember to include the basic HTML document structure shown on page 56 (Figure 4-7).
- Make sure table.html validates at http://validator.w3.org/#validate_by_upload
- Show your instructor that table.html validates.
2. Image Editing With GIMP
In this activity, we will take a full-sized landscape image and scale/crop it into a square (120 X 120px) thumbnail-sized version. Then we will create a basic web page that embeds the thumbnail and links to the full-sized version.
- Download siena.jpg by right-clicking and selecting Save Link As..
Be sure to save it in your lab4 folder.
- Open the program called "GIMP 2" by clicking on the Start Menu and typing "gimp" to find the program.
- Using GIMP, open the file (File --> Open) you just saved
- Scale the image (Image --> Scale Image...) so that it is exactly 120px wide by 120px high. The aspect ratio is locked, so you have to unlock the keychain icon next to the width and height.
- Notice that the image looks squeezed. The original image had a width of 1000px and height of 600px which is 5:3 aspect ratio. To make a square (1:1 aspect ratio) thumbnail image, we have to use a technique called "scale and crop."
- Restore the original image by undoing (Edit --> Undo Scale)
- Scale the image again (Image --> Scale Image...) but this time keep the keychain icon locked and set the height to 120px. Notice that the width is automatically set to 200px to keep the original 5:3 aspect ratio.
- The image should be resized to 200px X 120px.
- To make the image square but not squeeze the aspect ratio, we will crop out the left and right side.
- In the Toolbox, click on the Rectangle Select Tool, which is the very first tool on the top left.
- Use the Rectangle Select Tool to draw a box on the image.
- In the Tool Options, which are below the Toolbox, you can precisely set the position and size of the selection box. Set the position to 40 and 0, and set the width and height to 120. This should position a square selection box directly in the center of the image.
- Crop the image (Image --> Crop to Selection)
- Export the image (File --> Export) but be sure to call it smallsiena.jpg and make sure it is saved in your lab4 folder.
- Finally, create a basic web page called siena.html that embeds smallsiena.jpg using the
img
tag and use the a
tag to make the image a hyperlink to the full-sized image (siena.jpg).
- Show your instructor that siena.html displays the thumbnail image and links to the full-sized image.
3. HTML Forms
- Use pages 147-173 as a reference and complete exercise 9-1, 9-2, 9-3, and 9-4 using Notepad++.
- Make sure contest_entry.html validates at http://validator.w3.org/#validate_by_upload
- Show your instructor that contest_entry.html validates.
Deliverables
Upload contest_entry.html to Blackboard