![]() ![]() 16 September 2000 ![]() If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums |
![]() |
Hands on your home page -- I
Nowadays it looks like everyone has
his or her own home page, do you have one? I do, since a few years back I more or
less had to get myself such a page. And many more have had to, wished to try it
out, liked to, or even loved to get a home page. The reasons differ but they have
got one, or more probably a few pages. The questions arise: Do you need a home page?
Is it hard to get one? How to do it? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Hyper Text Mark-up Language
The tool to set these links, to format
the text, to make it possible to add a few pictures and so forth, is the Hyper Text
Mark-up Language (HTML). At this point we shall remember that HTML was mainly thought
for pages of text, as the scientists still produce essays and theses. That the web
should evolve into today's sites competing in fripperies was not close to anyone's
mind at the time being, and hence HTML is, and shall remain, a bit sparse. On the
contrary it is not hard to learn, and we will see why. |
|
Within the document a header is placed,
where you can put stuff like the title, that is shown at the browser's title bar.
Save this beginning under the file name index.html and you may view it for yourself using your
own browser. The starting page is best named index.html
since every web server look
for that file if no file is specified by a visitor. If no default file is found
the server will return a list, or an index, of the directory specified, something
you perhaps do not like. Sub pages may be called with any name, but avoid white
spaces or non-standard ASCII characters, since you will never know how different
ISP's servers will treat such characters. On the other hand, upper or lower case
is treated as different characters and may be used to differentiate between files.
HEX |
ten |
HEX |
ten |
|
01 |
0 + 1 = 1 |
|
2F |
32 + 15 = 47 |
09 |
0 + 9 = 9 |
|
30 |
48 + 0 = 48 (3 * 16 = 48) |
0A |
0 + 10 = 10 |
|
99 |
144 + 9 = 153 (9 * 16 = 144) |
0F |
0 + 15 = 15 |
|
9A |
144 + 10 = 154 |
10 |
16 + 0 = 16 |
|
9F |
144 + 15 = 159 |
11 |
16 + 1 = 17 |
|
A0 |
160 + 0 = 160 (10 * 16 = 160) |
19 |
16 + 9 = 25 |
|
AF |
160 + 15 = 175 |
1A |
16 + 10 = 26 |
|
B0 |
176 + 0 = 176 (11 * 16 = 176) |
1F |
16 + 15 = 31 |
|
EF |
224 + 15 = 239 (14 * 16 = 224) |
20 |
32 + 0 = 32 (2 * 16 = 32) |
|
F0 |
240 + 0 = 240 (15 * 16 = 240) |
21 |
32 + 1 = 33 |
|
FF |
240 + 15 = 255 |
<BODY BGCOLOR="#FFFFFF">
The table to your right shows a few
HEX values and how the ten based equivalent is computed. Anyway, HEX value FFFFFF
is white, but 000000 is black, 999999 is gray, but FF0000 is red. Any value between
00 and FF is accepted, so try them out. Quite a few hand held calculators compute
these values like a breeze, or compute them by hand.
<BODY BACKGROUND="bg.gif">
If you would like a background image this is the tag. Images can be any GIF or JPEG
(JPG) file you like. If they do not fill the entire browser they are tiled both
side by side and row by row. Hence most backgrounds are made rather small (to reduce
the file size and download time) and made to make a nice pattern tiled. Or they
are made a veeeery wide image but not that high, 1500 x 3 is not uncommon
and will fit most screen resolutions. Still file size is small.
Background color or images may look
nice to you, but be aware that the page will remain readable to any user. Some colors
or backgrounds do not make the text easier to read, other will not be rendered that
nice on some browsers, especially if they are older or do not support some of your
tags, as (IBM) Web Explorer do not. Or Lynx <grin>.
|
Text is typed as any text is typed,
no difference to it. There are only two tags to use, Paragraph, that gives
you an empty line between the paragraphs, and BReak-line that only starts
the text at new line but no line in between. Both P and BR can be stuffed with extra
tags to extend the functionality. One example is shown below, ALIGN=RIGHT
is added to the P tag, and the following text is right aligned. LEFT (which
is default), CENTER, RIGHT and JUSTIFY (that is not always
supported by the browser), are qualified extensions to ALIGN. (To BR you can add
CLEAR=ALL, that is mainly used in conjunction with tables and images and will not
be discussed this time.)
Paragraph centric has the side effect
that any new lines or excessive white spaces you type are ignored, the browser only
looks for one blank at a time, and do nothing about new lines or new paragraphs
until a P or BR is found, except for headers, rulers etc., that will come. If you
have to insert extra white spaces you must use the special character
that is No Break SPace. In fact the white space is both always
rendered by the browser and it will be considered part of the word, hence the line
will not be broken at that place, so it is wisely used to numbers together with
quantifiers, e.g. 1024 bytes, where it will be rendered as a white space
and the number will always stick to the quantifier.
Another feature that can be used
is to separate text blocks with horizontal rulers. Simply use the HR tag.
A ruler can be extended to be ALIGNed LEFT, CENTER or RIGHT, but that is only useful
if you set the ruler's SIZE to some value less than the browser width. The
best way to accomplish that is to use the percent value, e.g. SIZE="50%"
(note the quotes), as an opposite to SIZE="1,500" that is 1,500 pixels
whether the user own such a wide screen or not. Best is to leave the value to the
browser to compute.
From time to time you will quote someone, or indent the text anyway, and then you
use the BLOCKQUOTE tag. Quotations are both left and right indented, as this
text block is. And it is possible to put blocks within other blocks, if there is
a need for that, as seen below.
The best way to use headers is to use the Header tag that is available in
sizes from 1 to 7, e.g. H3, and 1 is the biggest down to the close to invisible
7 that is smallest and not always supported by the browser that realizes that "this
will be to small, I'll make it bigger". Many page maker software put extra
tags to headers but the basic headers are useful as is.
|
The next step is to format the text
itself a bit. Basic HTML do not give you that many ways to style your document,
but I consider them usable for their purpose, you may set text bold using the <STRONG>
tag (in fact it is the browser that decides if STRONG should be considered bold,
but most browsers use that interpretation). The other more used tag is the <EM>
tag and the text goes italic. From time to time underline or strike
through can be used, <U> and <S> for short. Any of
these tags have of course to be stopped by a </...>.
We now continue with FONT
that gives you an opportunity to format both the text SIZE and the text FACE.
Font sizes can be changed within the range 1 to 7, but the easiest way to change
the size is to use the + or - signs, e.g. SIZE="-1" or SIZE="+2", that changes the size relative to the base
font size that may be set both by the browser settings (default is 3) and by the
basefont tag that I will not show here. The font FACE can be set to "Helv,Helvetica,Arial"
or "Tms Rmn,Times New
Roman". Default is set by
the browser preferences.
Programming code and such text is preferably modified by
the <CODE> or <TT> tags.
If combined with <PRE>,
as in PREformatted, the paragraph
centric way to treat text is canceled,
the text will be treated exactly as typed,
lines do not have to be broken by a BR or P tag.
|
Clearly it will be tiresome to type
all those extra formatting tags, hence the web page maker software, but still it
is good to know what they are doing, and I promise you that I still write quite
a lot of HTML manually, to get the pages my way. To these tags there are quite a
few more, but these you will learn yourself by trial and error.
List type |
Code |
(New list)
|
<OL TYPE=1> <LI> Ordered, numeric, first level <OL TYPE=1> <LI> Next level <LI> Same level, next item </OL> <LI> Out one level </OL> |
|
|
(New list)
|
<OL TYPE=A> <LI> Ordered, capital letters, first level <OL TYPE=I> <LI> Next, capital roman letters <LI> Same level, next item </OL> <LI> Out one level </OL> |
|
|
(New list)
|
<OL TYPE=a> <LI> Ordered, small letters, first level <OL TYPE=i> <LI> Next, small roman letters <LI> Same level, next item </OL> <LI> Out one level </OL> |
|
|
(New list)
|
<UL TYPE=DISC> <LI> Unordered, disc type, first level <UL TYPE=SQUARE> <LI> Next level, square <LI> Same level, next item </UL> <LI> Out one level </UL> |
|
|
(New list)
|
<DL> <DT> <STRONG>Definition lists</STRONG> <DT> First line to be defined <DD> Some explanation or so <DT> Next line to go <DD> And another line </DL> |
|
|
The basic link has A HREF, A is for
anchor and I suppose HREF may be understood hyper reference. The destination is
enclosed by quotes and may be an Internet address, a web page close to the page
you are actually viewing or a locally stored file. The text shown and clickable
is enclosed by the <A HREF... tag and the </A> finishing tag.
The difference between the two links
above is plain, the WarpCast link is simply a fully qualified Internet address.
The http:// may be changed to ftp://, news: or mail: as you need different features
to help you.
The Java link on the other hand refers
to a web page located very close to the page the link is located at. Since it is
only a file name, it has to reside in the same directory since there is no
reference to another directory. Hence, the web browser will look the link up at
the actual address base, if that is www.os2ezine.com/000916/ the browser will look
for the new file there.
On the other hand, you may redirect
the browser to a relative directory. The index.html link is such a relative
directory, the two dots says you have to go up one level. If you have to
go up many levels you simply extend the chain to ../../../index.html
and so forth. If you on
the contrary want to go down in the file structure, you give the address
as images/plain/example.gif where images has to be a directory at the same level
the actual page resides at. Finally you may chain like
../../images/plain/example.gif,
that is two steps up and two down on another branch. Relative addresses are really
good to use since they work both on-line and off-line, that is, if you have downloaded
a site not using relative but direct URL:s, you can not surf it off-line.
Tag |
Closing tag * |
Meaning |
Note |
... applied to document |
|||
<HTML> |
</HTML> |
Document type |
|
<HEAD> |
</HEAD> |
Header block |
Not always necessary |
<TITLE> |
</TITLE> |
Browser Titlebar |
Not necessary |
<BODY> |
</BODY> |
Body block |
BACKGROUND image and/or BGCOLOR can
be set |
BACKGROUND |
|
Background image |
E.g. BACKGROUND="bg.gif" |
BGCOLOR |
|
Background color |
E.g. BGCOLOR="#FF00FF" that
is violet |
... applied to text blocks |
|||
<Hx> |
</Hx> |
Header line |
x is a digit between 1 and 7 |
<P> |
( </P> ) |
Paragraph |
ALIGN can be set |
<BR> |
|
Break, line |
ALIGN can be set |
<HR> |
|
Horizontal rule |
SIZE and WIDTH can be set |
<BLOCKQUOTE> |
</BLOCKQUOTE> |
|
|
... applied to text |
|||
<STRONG> |
</STRONG> |
|
Mostly rendered as bold |
<EM> |
</EM> |
|
Mostly rendered as italics |
<U> |
</U> |
Underlined text |
|
<S> |
</S> |
Strike through |
|
<FONT ... > |
</FONT> |
Font attributes |
SIZE and/or FACE must be set |
<CODE> or <TT> |
</CODE> or </TT> |
Code text style |
|
<PRE> |
</PRE> |
Preformatted text |
Text is rendered as typed, format is
preserved |
List tags |
|||
<OL> |
</OL> |
Ordered list |
TYPE can be set; = {1, A, a, I, i} |
<UL> |
</UL> |
Unordered list |
TYPE can be set; = {DISC, SQUARE, CIRCLE} |
<LI> |
|
List item |
May be another list |
<DL> |
</DL> |
Definition list |
|
<DT> |
|
Definition term |
|
<DD> |
|
Definition |
|
Link tag |
|||
<A HREF="..." |
</A> |
Hyper link |
The tag and the finishing tag encloses
the address. http://, ftp://, news: or mail: are
used to addresses. |
Miscellaneous tags |
|||
|
|
no break space |
white space that is non-breakable |
ALIGN |
|
Align |
LEFT, CENTER or RIGHT |
SIZE |
|
Size |
E.g. SIZE="+1", SIZE="5" |
WIDTH |
|
Width |
Value in percent or pixel, e.g. "10%"
or "10" |
* Tags within parentheses are optional |
Next time we will add images, but
more, we will look into some real pit falls with images. So, if you, contrary to
expectation, have not got yourself PMView, go for it. There are other software available
that can do the same work, but in the OS/2 community it is one of the best tools
for web imaging. You cannot draw images but you can edit colors, add filters, resize,
convert and read most image file formats known to humans. CU later.
The resulting HTML page.
Previous Article |
|
Next Article |