Exercise 1 - Basics of HTML

This first round of exercises is to get faimiliar with the most common HTML elements and how to use them in a WWW document. You will use HTML-Kit editor whose basic properties will be reviewed. You will also use a HTML validator. For examples of using XHTML-elements see the second leture.

HTML-Kit

  1. Log in to AGORANET with your own username.
  2. Start HTML-Kit (Start|Programs|HTML-Kit|HTML-Kit)
  3. Select Create a new file and click OK.
  4. Let's change some HTML-Kit settings to more reasonable ones: Select Edit|Preferences.

    Click the Proofing tab. Click off the first three check boxes to get rid of automatic language check that may be disturbing (especially for the Finns as it can only spell English).

    Select TIDY and option XML for Output:. Now the HTML-tidy programme inside HTML-Kit can correct or notify you of possible errors you make.

    Click OK to accept the changes.

  5. Copy the following code to clip board and paste it to your HTML-Kit document.
    
    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    
    <head>
    
    <title>Charaterizing title</title>
    
    </head>
    
    <body>
    
    <h1>Heading</h1>
    
    </body>
    
    </html>
    
    
    You can use this as a base for all your HTML-documents. You can also insert it to the HTML-Kit settings: Edit|Preferences|Startup|Insert following text into new documents.
  6. Save your document to U:\networks\ folder as demo1.html. Use the same folder for all the documents in the future.
  7. Copy the news etiquette doument Fiksu lukeminen by Jukka Korpela to clip board.
  8. Paste it inside the body element.
  9. Save. Use a browser to see how your document looks. Pressing F8 opens the HTML-Kit document in you default browser. The document should be just contiuous text as the structure of the document has not been defined so far.
  10. First write the title for the document. Write Fiksu lukeminen [Nyysiopas] inside the title element (Smart reading [News instrutions]). The text is shown in the upper edge of the browser window.
  11. For the main title, use h1 inside the body element. Select the text Fiksu lukeminen from the beginnig of the body element with the mouse and press ALT-INSERT. HTML-Kit asks which elemet you want to use for the selected area. Use h1.
  12. Save your document and see how it looks in the browser window. Click Reload or Refresh on the browser window to update the document. The first heading should now be distinct from the rest of the text.
  13. Then back to HTML-Kit. Delete the text above the main title.
  14. Let's continue with the struture of the doument. Open the page from where you copied the text next to the HTML-Kit window. Find all the second level headings from Korpelas text. The first one is Lukemisen tapoja: säännöllinen, satunnainen, kerrallinen. Find the respective sentences in HTML-Kit and mark them with h2 element. Use CTRL-H to find the text and ALT-INSERT for setting the elements. When you are done with the headings, save the doument and see how it looks.
  15. Then mark all the paragraphs with the element p as above. Save and compare the document to the original article by Jukka Korpela.
  16. Of the block elements the list and the thread example are still missing. An example of a list:
    
    <ul>
    <li>First element</li>
    <li>Second element</li>
    <li>Third element</li>
    </ul>
    
  17. The next list is unorganized just as the first one, thus use ul and li.
  18. Then the next list is in the chapter about slang where Korpela has used an unorganized list even though it might be structurally more correct to use a definition list dl as it is about defining certain abbreviations.
    1. Mark all the text belonging to the list with dl.
    2. Mark all the defined words with dt.
    3. Mark all the definitions of the abbreviations with dd.
    An example of a definition list:
    
    <dl>
    <dt>HTML</dt>
    <dd>HyperText Markup Language</dd>
    <dt>CSS</dt>
    <dd>Cascading Style Sheets</dd>
    </dl>
    
  19. Form an unorganized list of the list in the end of the document.
  20. Then there is the thread example. Since it is a copy of a view of some news programme it should be presented as it is written to the HTML document. Normally the space bars and enters in between do not matter as the browser adjusts the text to the window automatically. Pre-formatted text should be added using the pre element. This element is commonly used when presenting program codes. So, mark the whole thread with pre.
  21. Now that you are done with the block elements, check the document by a validator to see if you forgot something or if there are any errors.
  22. Correct any errors found by Tidy and then try a validator.
  23. After correcting the document continue by marking the inline elements. Next thing is to make the links in the table of contents to work. First mark the headings where the links should lead. Add a unique id to every h2 element. That can be done by adding an id attribute to the h2 elements. An id has to start whit a letter. For example:
    
    
    <h2 id="h1">Lukemisen tapoja: säännöllinen, satunnainen, kerrallinen</h2>
    
    
    Add the id for every h2. The easiest way is to name them as heading1, heading2, heading3 and so fort.
  24. Then add the links to the table of contents. Hyperliks are marked by using the element a whose href attribute contains the address where the link should lead to. The element a contains the text presented as the link. For example:
    
    <li><a href="#h1">Lukemisen tapoja: säännöllinen, satunnainen, siltä väliltä</a></li>
    
    If the link is only inside the same document, the address should start with #. Add the links to all the headings to the table of contents and save. Use the browser to try if the links work. Validate and correct the errors.
  25. In the original doument there are many links to other documents. Add a few of these links just for the educational purpose.
  26. In a similar way, form the links for Internet virus warnings, rumors, and hoaxes and Hoax Warnings.
  27. Save the document and close HTML-Kit unless you are going to continue with the additional exercises.

Additional stuff

Do these extra exercises if you still have the time or the enthusiam after the previous ones.

Images

  1. Open a new blank document in HTML-Kit.
  2. Copy the same code as above for the base of the document.
  3. Save the image below to the same folder where your document is. Use the right button of your mouse for savig.

    Kurssin tenttipistemäärät: Hupu Ankka 25p, Lupu Ankka 20p, Tupu Ankka 26p, Aku Ankka 16p, Sepe Susi 6p

  4. Add a paragraph to your document (p).
  5. Insert an img element inside the paragraph element and add the following properties:
  6. Write sensible title and alt texts for the image.
  7. Save and see if the document works with the browser. Then validate and correct any errors.

Tables

See the lecture page to learn how to create tables. Then make a table like the one below under the image.

Date
TIME
Monday Tuesday Wednesday Thursday Friday
8-10 Group 2
Ag B211.1
Group 5
Ag B211.1
Group 9
Ag B211.1
10-12 Group 3
Ag B211.1
Group 6
Ag B211.1
Group 10
Ag B211.1
12-14 Group 7
Ag B211.1
Group 11
Ag B211.1
14-16 Group 8
Ag B211.1
 Group 12
Ag B211.1
16-18 LECTURE
Aud. 1
LECTURE
Aud. 1
18-20 Group 1
Ag B211.1
Group 4
Ag B211.1
http://appro.mit.jyu.fi/2001/syksy/tietoverkot/demot/demo1/index.html
© Petri Heinonen ()<URL: http://www.mit.jyu.fi/peheinon/>
7.09.2001 18:19:39