Tex-Guides | JCW Docs | Home |
Web pages are written in html (hypertext markup language). Like many other languages, html works by defining "environments".
Web pages can be written in "raw html" - using a text editor to type the commands and efine environments, or using something like Dreamweaver which is a more graphical programme and has much more flexibility. These notes are for a beginner to write their first web page using a simple text editor.
chmod a+r mywebpage.htmlYou only need to do this once for each page that you create.
<html> </html>
All other text on the page goes between these tags.
Next, all pages have a "head", and a "body". These environments are also defined by tags...
<html> <head> </head> <body> </body> </html>
Information like ownership of the page, keywords for search engines to use, redirections to other pages, ..., basically stuff that doesn't appear simply as text on the web page is stuck in the head. The only relevant piece of information for the head for our purposes is giving the web page a title. The title is the words that appear at the top of a web browser when it's looking at your page.
Add a title in the "head" region within "title" tags:
<title>My first web page<title>At this stage you should save your page, and can view it now (though it'll be pretty empty!). I shall assume you save the page with title firstpage.html (Canterbury University users: you should now save your page, and make sure that the permissions are set as above.)
You should now view your page in a web browser. For UoC physics users, the page location is:
http://www2.phys.canterbury.ac.nz/~where username is your usernam (mine is jcw83). note the tilde which is required also in the url./firstpage.html
The new page has a title in the top bar of the browser saying "My first web page", but otherwise no content yet.
<body> >h1< Welcome to my first web page >/h1< Hi. This is my first web page >h2< A second-level header >/h2< Second-level headers can be used to define subsections, and ot separate parts of your web page. </body>
<p>at the start of each paragraph. Experiment with this a little on your new page.
For lists, define the list environment with:
unordered list | tag = ul |
ordered (i.e. numbered) list | tag = ol |
Each individual list item in the list is started, like each paragraph with
<li>It is not necessary to close the list item tag but, like the paragraph tag, it is not an error to do so. An example list is written like:
<ol> <li> item number 1 on my list <li> second item on my list </ol>The output from this ordered list looks like:
To have b or emphasized text (italics), use
<b>...</b> <em>...</em>
<a href="http://www.the.web.page.ref/page.html">Words that represent link</a>Here it is usually good to just cut and past in the web location to avoid errors. The "words that represent link" will appear on your web page, and are underlined. When a user clicks on the underlined text, their browser is redirected to the http location. For example, to put a link to the news page of the BBC, you would do:
<a href="http://news.bbc.co.uk">Link to BBC news page</a>Which appears on your page like: (though it won't appear in an unordered list environment unless you specifically code it to).
<a href="mailto:physjcw@gmail.com">Feel free to email questions to me</a>This command will create a link so that the users browser opens up their default mail client with a compose window to email the person in the "mailto" field.
<img src="myphoto.jpg">If the image is too big, you can also include in the img tag a "width" or "height" tag. These are included in "point" sizes (72 points to the inch, so
<img src="myphoto.jpg" width=72>Will include your photo on the page, but only with width of 1 inch.
</h3>
to close what is actually an h2
field, or not having the "/" on the closing tag, will leave the
tag open. Common errors look like:
|
All Rights Reserved |
Email: physjcw@gmail.com |