![]() ![]() |
![]() | Patrice Koehl |
Introduction to Computers: Fall 2013Lab4: Creating a Web page using HTMLIn this lab you will learn how to create a web page using the basic programming language HTML.
The key notion to remember is that in the source code of a web page, its content, i.e. what you see, is mixed with the formatting, which does not appear when the page is displayed but controls its elements such as paragraph, breaks, pictures, links, and so on. Basic HTML programmingTagsAn HTML document, or "web page" is a succession of elements. Each element can have HTML attributes specified. Elements can also have content, including other elements and text. For example, the title element represents the title of the document. Most elements are written with a start tag and an end tag, with the content in between. An HTML tag is composed of the name of the element, surrounded by angle brackets. An end tag also has a slash after the opening angle bracket, to distinguish it from the start tag. For example, a paragraph, which is represented by the p element, would be written as: <p>In HTML, most elements are writtent as ...</p> There are a few exceptions, that is, tags that do not need an ending tag: <br> (paragraph break) is one of them.Note that there cannot be spaces between the < and the tag name, or between the < and the / in an ending tag, so the following are not valid tags: < title>, </ title>, < /title> Tag names are case insensitive, so <TITLE> is valid, as is <TiTLe>. Tags that are present in every HTML documentEvery HTML document begins with a <html> tag, and ends with a </html> tag. What comes between these is the actual web page. Anything that appears outside of these two tags will not show up if you display the page using a browser. HTML documents usually have two main sections: a header and a body:
Two very useful tagsTwo very useful tags are the tags for inserting links in an HTML document, the a tag (for anchor), and the tag for an image, img :
For more information on tags, you can look at the Wikipedia page on HTML elements.
An example of an HTML documentHere is a simple HTML document that creates a web page listing my hobbies during the summer: <html> <head> <title>My summer page</title> </head> <body> <h1>My summer hobbies </h1> <hr> <p> In the summer, I like to be active. Here is a small list of the activities I like to do:</p> <ul> <li>I like running in <a href="http://www.ucdtri.com/">triathlons</a></li> <li>I often go rock climbing at <a href="http://www.yosemite.org/">Yosemite</a></li> </ul> <body> </html> Some notes about this example:
StylesYou can change the appearance of a web page (i.e. the fonts it uses, the color of the background, text, ...) using styles. These styles appear in the header section, between the tags <style type="text/css"> and </style>. Here is an example: <head> <style type="test/css"> body { color: navy; background-color: #ffff66; font-family : sans-serif; margin-right: 15%; } </style> </head> Some notes about this style:
The assignmentFor this assignment, you will make your own web page using HTML programming. Name the web page file index.html. It can be on any topic. It must contain:
We recommend that you use notepad to create the web page. However, you are
free to use any other software/editor; we only require that your index.html file be
clean and readable (5 points), e.g., without unnecessary characters/tags/formats.
Submitting your workYou can create a zip file containing your file index.html and any pictures that you have included in your web page, and name it lab_webpage.zip.It is very important to turn in your assignment. If you do not turn in, you will not get your credit. USE SMARTSITE to save your assignment. If you are not sure how to do it, ask a TA for help. Do not forget to logout from the lab computers!GradingThere is a total of 27 points for this assignment. |
Page last modified 17 December 2015 | http://www.cs.ucdavis.edu/~koehl/ |