Difference between revisions of "Webpage Guide"
(→Basic HTML) |
|||
Line 16: | Line 16: | ||
* <code><Title></code> This is the title of the webpage--what appears in the top bar of the browser window. Be sure to turn it off after using it, so that all the text doesn't appear in that one bar! | * <code><Title></code> This is the title of the webpage--what appears in the top bar of the browser window. Be sure to turn it off after using it, so that all the text doesn't appear in that one bar! | ||
* <code><Body></code> This delineates the body of the webpage: all the text, images, etc that you want to appear on the page should go in between the Body on and off commands. | * <code><Body></code> This delineates the body of the webpage: all the text, images, etc that you want to appear on the page should go in between the Body on and off commands. | ||
− | * <code><br></code> and <code><p | + | * <code><br></code> and <code><p></code> Notice that if you just type text in an HTML file, the browser will ignore all enter keystrokes. In general, browsers treat extra "whitespace" as just one click of the spacebar. To tell a browser that you would like a line break, use br. If you would furthermore like a blank line to start of the next paragraph of text, use p instead. |
* <code><b></code>, <code><i></code>, <code><u></code>, and <code><s></code>. Bold, italic, underlined and strikethrough text, respectively. | * <code><b></code>, <code><i></code>, <code><u></code>, and <code><s></code>. Bold, italic, underlined and strikethrough text, respectively. | ||
+ | |||
+ | |||
+ | * <code><font size="n" color="rrggbb" align="rcl"></code> Set many optional properties on the font. Size takes a number as an argument; align takes one of "right", "center" or "left" as its argument; and color takes an RGB value as its argument. An RGB (red-green-blue) value is simply a 6 digit base-16 number, which means the digits can take any value from 0 to 9 and A to F. The first two digits give you the amount of red, the next two give you green, the last two give you blue. For example, fa8072 yields a tasty salmon color. To turn all these properties off, you just have to type <code></font></code>. | ||
+ | |||
+ | |||
+ | * <code> <body background="file/URL" bgcolor="rrggbb" link="rrggbb" vlink="rrggbb"></code> The optional properties for the BODY command, which set the background and the colors of links. Background takes either a filename (from you public_html directory) or a URL of another website, and sets that as the background. If it is too small of an image, it will be tiled. Bgcolor sets the background to a solid color if you don't want an background image. It, like link and vlink, takes an RGB value to set the color. Link is the color of an unclicked link; vlink is the color of a clicked link. | ||
+ | |||
+ | |||
+ | * <code> <img src="file/URL"></code> For inserting an image onto you webpage. The argument for src is either a filename or pathname for an image in your public_html directory, or else a complete URL to an image elsewhere. | ||
+ | |||
+ | * <code> <A HREF="URL">text</A> </code>. For links to pages on your site or on other sites. This can also be used to link to a PDF file or some other file for download. The URL is either the full URL for some other website (including the initial <tt>http://</tt>), or else just a pathname for an html file in your public_html directory. When the link is clicked, this is the page the browser directs you to. "Text" is just the text of hyperlink. For example, you may want the text to say "Solutions to Homework 9", but the URL will be something like "solutions9.pdf". | ||
===Learning More HTML=== | ===Learning More HTML=== |
Revision as of 01:43, 26 September 2006
This page provides a basic tutorial on how to create your own webpage on the math department server. Before proceeding, please make sure you understand basic file management, especially setting file permissions.
In your home directory, you need to create a directory called public_html . All files and directories for your webpage need to go in this directory, and the directory and all its contents must have their permissions set so that others can read the files and read and execute the directories. Make sure that any content you want on your webpage, like pictures, pdf's, etc., is located in public_html.
Additionally, public_html should have a file called index.html , which will be your homepage, i.e. the first page that pops up when someone visits your website. Once you've created this file (and set its permissions), your website's homepage will have the URL: /~<username>. In general, if you create a webpage called foo.html, it's URL will be /~<username>/foo.html.
Create html files using your favorite text editor. On the departmental computers, emacs and pico are two standard text editors.
Basic HTML
Each individual webpage on your site corresponds to a file of the form name.html . An HTML file just consists of plain text with a couple commands that tell the browser to do something to the display (for example, make the text bold font). Just like in LaTeX, there are some special characters that tell the browser "I am giving you a command"; they are <, > and /. Every command takes the form <command>
, and most commands also allow you to turn them off by typing </command>
. For example, if you want to turn on bold font, type <b>
. When you are done typing the text that you'd like bold, turn off bold font with </b>
.
The nice thing about HTML is that it is very forgiving--even if you make a mistake it will try its best to render something in the browser. This makes it easy to see the mistake and usually makes it easy to see how to fix the mistake too. Commands are case-insensitive.
<HTML>
In principle, every .html file should begin with<HTML>
and end with</HTML>
to let the browser know that you are going to use HTML commands. But if you plan on just writing plain text, then this is not necessary.<Title>
This is the title of the webpage--what appears in the top bar of the browser window. Be sure to turn it off after using it, so that all the text doesn't appear in that one bar!<Body>
This delineates the body of the webpage: all the text, images, etc that you want to appear on the page should go in between the Body on and off commands.<br>
and<p>
Notice that if you just type text in an HTML file, the browser will ignore all enter keystrokes. In general, browsers treat extra "whitespace" as just one click of the spacebar. To tell a browser that you would like a line break, use br. If you would furthermore like a blank line to start of the next paragraph of text, use p instead.<b>
,<i>
,<u>
, and<s>
. Bold, italic, underlined and strikethrough text, respectively.
<font size="n" color="rrggbb" align="rcl">
Set many optional properties on the font. Size takes a number as an argument; align takes one of "right", "center" or "left" as its argument; and color takes an RGB value as its argument. An RGB (red-green-blue) value is simply a 6 digit base-16 number, which means the digits can take any value from 0 to 9 and A to F. The first two digits give you the amount of red, the next two give you green, the last two give you blue. For example, fa8072 yields a tasty salmon color. To turn all these properties off, you just have to type</font>
.
<body background="file/URL" bgcolor="rrggbb" link="rrggbb" vlink="rrggbb">
The optional properties for the BODY command, which set the background and the colors of links. Background takes either a filename (from you public_html directory) or a URL of another website, and sets that as the background. If it is too small of an image, it will be tiled. Bgcolor sets the background to a solid color if you don't want an background image. It, like link and vlink, takes an RGB value to set the color. Link is the color of an unclicked link; vlink is the color of a clicked link.
<img src="file/URL">
For inserting an image onto you webpage. The argument for src is either a filename or pathname for an image in your public_html directory, or else a complete URL to an image elsewhere.
<A HREF="URL">text</A>
. For links to pages on your site or on other sites. This can also be used to link to a PDF file or some other file for download. The URL is either the full URL for some other website (including the initial http://), or else just a pathname for an html file in your public_html directory. When the link is clicked, this is the page the browser directs you to. "Text" is just the text of hyperlink. For example, you may want the text to say "Solutions to Homework 9", but the URL will be something like "solutions9.pdf".
Learning More HTML
If you come across a webpage and want to know how they did that, you can try looking at the webpage's source. Most browsers have a View Source option in their menu; this will bring up the HTML page which you can examine.
Also, there are many other HTML tutorials and reference guides. One reference can be found here.