The purpose of this lab is to let you learn HTML programming and make your own webpage. First, read the HTML tutorial. While you're using that you can use any text editor (including Eclipse) to write your HTML code. When you're ready to try Eclipse, follow the directions below.
<html> <head> <title> My first webpage </title> </head> <body> I just produced my first webpage. </body> </html>
Your webpage will look a little dull at this point. based on your readings from the HTML tutorial, you should be able to do much better. Choose a topic and make a webpage of your own. A good idea might be to design a page about a hobby of yours. Any subject will do. Just include at least one of EACH of the following HTML elements (and use them properly) in your webpage:
The webpage you created in still inside your IDE workspace. This means, your index.html is stored by eclipse and is accessible only by you. You have to store this webpage in a Webfolder which is accessible to everyone via the internet. All duke ACPUB accounts have a public_html folder by default. This is where you have created your cps1 directory and you need to store your index.html file in this.
You have to export this project from the eclipse workspace to the windows File System. (If all this sounds confusing, just follow the instructions below and you won't have to understand this "workspace" concept as of now.)
You can view your index.html file locally (i.e. via the File
system) by clicking on My Computer on the desktop and choosing
My Computer -> P:
drive -> public_html -> cps1 -> lab1 and then clicking on the index.html file.
To view your webpage via the internet, open a web-browser (ie Internet Explorer , Netscape etc.) and enter the following address in the address bar:
www.duke.edu/~xyz99/cps1/lab1/
Replace xyz99 by your Duke ID. This is how your Lab TAs will view and grade your labs, all of them. They will not be able to see your webpage if you have named it something other than index.html or named the project something else or exported the eclipse lab1 project to a location other than P:\public_html\cps1 . Hence it is required all the students follow a uniform naming scheme.
When you finish changing your page, make sure you saved the final version and then start shutting stuff down. You mostly start hitting the little X's in the upper right-hand corner of each window. If you are about to destroy something important, you will get a warning, so do it carefully. Make absolutely sure you do not leave any windows open! If you do, anyone who walks by feeling malicious can get you in trouble. And that's it. You're done!
LOGOUT OF YOUR MACHINE BEFORE LEAVING THE LAB! (Double-click the Logoff icon on the Desktop)
Cascading style sheets (CSS) are one of the preferred methods for formatting webpages. Style sheets give web developers control over fonts, colors, and layout. The idea is that the document structure (usually written in HTML) should be separate from the document preseentation (in CSS). This separation is useful in adapting pages to the whatever web browser is being used and improving accessibility.
Style sheet syntax is made up of three parts: a selector, a property, and a value in the following order.
selector {property:value}The selector is the tag or element to be defined, the property is the attribute of that selector to be defined and that property has a value. For example,
h1 {color:blue}sets all <H1> tags to be blue, while the following:
h2 {color:blue; font-size: 14pt}sets <H2> tags to be blue and of 14 point size. Check out the CSS Introduction by W3schools (http://www.w3schools.com/css/css_intro.asp) for more information.
For extra credit, create a style sheet for your webpage to do at least the following:
Check the readings from the HTML tutorial or see the tutorials linked on the course resources page for more information. Also, raise a hand and ask the instructor or the TA.
When given a web-address which ends in a folder name like www.duke.edu/~xyz99/cps1 (where cps1 can be any folder), by default the browser looks for an html page named "index.html" so make sure you have named your file correctly. (All letters should be lower-case)
If you want to name your html page something other than "index.html" then the path to that page should be given with the name of the page included.
e.g.: www.duke.edu/~xyz99/cps1/not_named_index.html
Also, the address to your web-folder (which is your public_html folder) is www.duke.edu/~xyz99/ . Although, you might choose to have a lot of folders and data on your ACPUB account (which is ~ 70 MB for me, I think, only the files/folders which you create or copy into the public_html folder will be accessible over the internet.
This being an introduction to HTML, we have used a bare-bones approach to creating html webpages. In future lectures we'll see how to do a better job with CSS presentation.
The lab has been adapted from the Spring 2006 cps001 HTML lab. That lab pas produced by Siddhesh Sarvankar.