HTML-- Hypertext Markup Language
Why learn HTML?
HTML Page StructureA page consists of "tagged" elements.The start tag defines the type of each element. An end tag marks the end of the element. For instance, here's a paragraph element:<p> The text of the paragraph. This might be a number of lines </p> Here is an "anchor" tag, which defines a link to a resource (url): <a href="http://cs.usfca.edu/~wolber">My Home Page</a> In the anchor sample
Uploading your Page to the WebThe next step is getting the file onto the web.
Generally, this means you need to upload the file into a directory that
some web server knows about. This is not difficult, but its a step that
keeps a lot of people from creating web pages. On
USF computer science accounts, you can put web pages in a special folder so that they
are accessible on the web. If you are using Linux, you can access that folder by clicking on the public_html folder in your home directory.This is actually a symbolic link to the folder at /home/web/yourUserName, but you can treat public_html as any other sub-folder. Open the public_html folder In the the File Manager, and find the file. Right-click the file and select properties. Click on the Permissions tab. For "others", allow read access to the file. After this, the file is accessible on the web. The mapping from web folder to URL is a bit strange, but the URL for files in your public_html will be: http://cs.usfca.edu/~yourUserName/test.html. USF Information Technology (IT) also provides a hosting service, USF Files, where you can upload web pages. Here's how to use it: 1. Go to usfconnect and login 2. Choose USFFiles from the top-right menu 3. Upload your html file into your public folder 4. The page is now public and accessible on the web. Professor Wolber's files would be accessible at: Google's App Engine lets you store web pages on Google's servers-- in the "cloud". You can put both static web pages (HTML and CSS) and dynamic web pages which also have program code. HTML Page StructureTo
create an HTML file from scratch, you'll need the following basic structure: <html>
<head> <title>Title of Page </title> </head> <body> </html>this is the stuff that will appear on the page. </body> Within the head tags, you'll put a title, as shown. The text will display in the top of the browser when your page loads. You'll also put links to CSS style files and javascript files within the head tags. Common HTML ElementsThe contents for the page appear within the body tags shown above. Here, you'll put paragraphs, links, section headers, images, and end-lines (breaks). Each item in the page is called an element. Here are the most common ones:Element Example Anchor (link) <a href="http://cs.usfca.edu/~wolber">My Home Page</a> Paragraph <p> text of your paragraph </p> Headers <h1>this is a top level heading for your page </h1> <h2> this is a second-level heading </h2> Image <img src="http://someimage" /> Break <br/> Absolute vs. Relative URLSThe anchor and image components described above refer to other resources. Those resources can be absolute or relative. An absolute URL is one you can type in the browser. A relative URL is one from the same server and the path provided is in relation to the current page's location on the server. For instance, suppose the following component is in index.html, which is at the root of a site:<img src="images/mypic.jpg"/> This tag refers to an image stored on the server in the images directory which is relative to where index.html is, that is, the root of the server. Your Turn:1. Open a text editor and create a web page of your choice, but make sure it has an example of each of the components described (image, anchor, paragraph, etc). First save the file in your home directory. Then open a browser and File | Open the file you just created. Does it appear? Now select View | Page Source. The HTML from your file should be displayed. Note that your file is not yet on the web.2. Upload the file you created in (1) to the CS web server. You can do this by dragging the file from your home folder into the public_html folder. 3. Set the permissions so the file is readable by everyone. Right-click the file in the file manager, select Properties and then Permissions, and set others to be able to read. 4. Open a browser and access the page. My username is 'wolber', so I can access a file test.html at: http://cs.usfca.edu/~wolber/test.html |