HOW TO BUILD A PROFESSIONAL WEB SITE     Rel. 1.1

LESSON 04

How to build a Professional Web Site by Carlo Scodanibbio Valid XHTML 1.0!


I know what you are looking for !
The solutions of last Lesson's Exercises !
No problem, here they are: Exercise 02 solution is here, and Exercise 03 solution is here. Voilá !
How did you do ??


more about text - formatting text

Let's progress one more step. To understand how a Browser works, type the following sentence in your Testpage:

img

Now just "refresh" your Browser. This is what you get:

img

Hoh! Hoh! What's wrong with your Browser ?
Nothing wrong. Browsers do not recognise formatting. Unless you instruct it otherwise, the Browser just displays all your text in a steadily flowing stream. The Browser won't recognise more than 1 space. The Browser does not know when you want to start a new line. Nor does it know that you want to start new paragraphs. Unless you instruct it. This might seem pretty stupid.... In fact, it's better to have it this way. It gives you total control over the document's appearance.

If you want to start a new line you have to use a LINE BREAK.
If you want to start a new paragraph you must use a PARAGRAPH TAG.
And if you want more than one empty space in a line you must use the SPACE CODE.

The "STANDALONE" (does not require a CLOSING TAG, under the HTML 4.0 Standard) TAG for a LINE BREAK is <BR>

<BR> simply instructs the Browser to start a new line.

The TAG for a PARAGRAPH is <P>
<P> instructs the Browser to start a new Paragraph (starts a new line, then skips a line).
The PARAGRAPH Tag may be used in STANDALONE mode or with a corresponding Closing Tag </P>.
Normally, to obtain "vertical spacing", only the Opening Tag <P> is used by most Web Designers, except in certain cases which I will discuss later in another lesson.

The Special SPACE CODE for one space is : &nbsp;
This is a "Special Character" (more on Special Characters below).
A Special Character always starts with the & (ampersand) sign and ends with a ; (semicolon).

So, the Special code for 8 spaces like in our example will be : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

In conclusion the right way of writing the previous sentence is :

img

which will result in this:

img

Please note the following:




And now, how about some exercising ? I am sure you were longing for it......

Exercise 04
sayyes

Make a Web Page that looks similar to this:

img

Not too difficult, heh, heh....
Now, let me say something about Exercises: from now on you should try to make your Exercises "similar" to those I am proposing. This means:

In conclusion, what is important is that you understand the principle and the syntax behind any exercise, and that you try to keep approximately the same proportions and layout. Bong.



about special characters

You cannot type all text character from your keyboard: firstly your keyboard does not have many text characters (for instance certain characters used in other languages, or in math equations) - secondly, certain characters would terribly confuse all Browsers in this world, if typed from the keyboard: typical example the < and > signs (used to encapsulate HTML Tags), if used in a math equation.

There are five very important special characters :

Spec. Character Symbol Description
&nbsp;   non-breaking space
&lt; < less-than
&gt; > greater-than
&amp; & ampersand
&quot; " quotation mark

So the HTML standard makes allowance for entering many different characters, including the so called ASCII characters, within your text, through special encoding of each character entity.
There are two codes allowed for special characters in the HTML language:

In both the above coding methods, the & of a Special Character simply tells the Browser we are inserting a SPECIAL CHARACTER in the textual content - the semicolon means we are ending a SPECIAL CHARACTER - whatever is in between is a code that, hopefully, all Browsers will understand.
Hopefully because, in spite of all Standards, the behaviour of the various available Browsers in their various versions is not always predictable - besides, special characters may or may not be displayed depending on user's platform (computer, operating system, etc.) and user's selected font for display.

hot, hot, hot...
TIP
Here is another way of making multiple blank lines using the NON BREAKING SPACE Special Character:
<BR>&nbsp;<BR>
A sequence of these notations will create multiple blank lines (but do some experiments yourself).

      It is not necessary to use special characters all the time, in fact you need to use them only to insert characters you do not have available in your keyboard and also in instances when typing the real character would confuse the browser.
For this there is no simple rule. It will just come with practice.
For instance I am using these Special Characters a lot in all my Lessons of this Course: do you wish to have a look at it ? Just right click anywhere in this page and view the HTML code..... You will be very impressed, I suppose.


A comprehensive List of all CHARACTER Entities is here.



other text manipulating tools - text alignment

There are several HTML Tags and Attributes that can be used to format and manipulate text.
I am illustrating the most used ones, but there are more (I will tell you later where to find them).

We have already seen the Tag <CENTER> to centre text.
Now, what about aligning text to the right of the Browser Window ?
There are two ways (so far....).

The one way is to utilise the DIVISION Tag <DIV>.
This Tag is a "Container Tag", used to "contain" stuff such as Text, Images and other. Its function, besides containing something, is also to "position" it somewhere in the Browser Window through the ATTRIBUTE ALIGN that can be set at:

Some examples to clarify the use of this Tag.

<BODY>
<DIV>
Hello baby !!</DIV>
<BR><P>
<DIV ALIGN="left">
Good morning to you</DIV>
<BR><P>
<DIV ALIGN="center"><B>
What is your name ?</B></DIV>
<BR><P>
<DIV ALIGN="right"><FONT SIZE="4" COLOR="#9900CC">

How about movies tonight ?
</FONT></DIV>
</BODY>

This code will be displayed like this:

img

REMARKS:



Another way of aligning text is through the use of the (already seen) Paragraph P Tag and its Attribute ALIGN.
Something I did not tell you earlier, in fact, is that the P Tag accepts several Attributes including the ALIGN one.

The syntax is identical to that of the DIV Tag so I am not going to repeat it but just give you an example:

<BODY>
<P>
Hello pussy cat !
<P ALIGN="left">How is life pussy cat ?</P>
<P ALIGN="center"><I>
Did you catch any mouse today ?</I></P>
<P ALIGN="right"><FONT FACE="verdana, arial" SIZE="3" COLOR="#990033">
Would like some prawns for supper ?</FONT>
</BODY>

The above code will result in this:

img

REMARKS:





other text manipulating tools - headings

Let's now talk of a subject related to the previous one.
The HTML Standard strongly recommends the use of HEADINGS to identify the various areas of a textual (and not only) Page: Headings are what the word implies, sort of Dividers and Titles for blocks of text embedded in the Page.
Headings break the current flow of text, standing alone on lines separated from the preceding and following text. This is obtained without inserting any BREAK or PARAGRAPH Tag, it is a built-in feature of Headings.
Now, Headings are totally optional (in fact they are rather seldom seen on the Net), but I join the W3C Organisation in recommending their use. When, in future Lessons, we shall be talking of Cascading Style Sheets and Dynamic HTML, you will fully understand why Headings can be very handy. For the time being just believe me: they are very useful.

There are 6 levels of Headings in the HTML Standard, and they are obtained through the use of 6 different pairs of Tags:
<H1></H1>
<H2></H2>
<H3></H3>
<H4></H4>
<H5></H5>
<H6></H6>

Text contained in a pair of Heading Tags gets displayed by Browsers in very large (H1, H2..) to very small (H5, H6) font size, without using the FONT Tag at all.
Normally, the text inside a H4 Heading gets displayed as ordinary size text (size 3).
The FACE used is normally the default FONT (Times New Roman).
The default text colour is normally black.
Some browsers display contained text in boldface.
Each version of each Browser has its own way of rendering text within Headings: the difference, however, is not excessive.

Some examples will give you a better perspective on the subject:

<BODY BGCOLOR="#FFFF99">
<H1>
Welcome to Rapounzel's Web Site</H1>
Blah, blah, blah, etc. etc.
<H2>Welcome to Rapounzel's Web Site</H2>
Blah, blah, blah, etc. etc.
<H3>Welcome to Rapounzel's Web Site</H3>
Blah, blah, blah, etc. etc.
<H4>Welcome to Rapounzel's Web Site</H4>
Blah, blah, blah, etc. etc.
<H5>Welcome to Rapounzel's Web Site</H5>
Blah, blah, blah, etc. etc.
<H6>Welcome to Rapounzel's Web Site</H6>
Blah, blah, blah, etc. etc.
</BODY>

This is what the Browser displays:

img

Rather self-explanatory, I suppose: you may easily see the difference between ordinary (default) text and text contained within the 6 Headings.

Obviously you may beautify your Heading Text using the FONT Tag to specify a different FACE than Times New Roman and a different COLOR from black. This is shown in the example that follows.
However, I cannot guarantee that all versions of all Browsers will respect the change imposed by a FONT Tag to the H built-in style.
You can definitely use, within Headings, other style Tags such as I, U, CENTER, etc.
But there is another interesting feature associated to Heading Tags: all the 6 of them accept the Attribute ALIGN, with a syntax identical to DIV and P. Therefore you may use the H Tags also to align your text conveniently. Also this aspect is shown in the following example:

<BODY BGCOLOR="#99CC66">
<H2 ALIGN="center"> <FONT FACE="courier new, times new roman" COLOR="#660033">
this is the most fascinating <BR>page on the web</FONT></H2>
<BR><P>
<H3 ALIGN="right"><B><I><U>
in fact you will discover that the most incredible <BR>mysteries of the universe are fully explained in my page
<BR>keep on reading blah blah blah etc. etc.</U></I></B></H3>
</BODY>

MS Internet Explorer will display the above code as follows:

img

All right with Headings ?




other text manipulating tools - blockquote

Let's consider the Tag BLOCKQUOTE

What it does: it pulls margins in from both sides of the Browser window. Example:

<BODY BGCOLOR="#000000">
<CENTER><FONT FACE="Times New Roman" SIZE="4" COLOR="#FFCC00">

OUR COMPANY's MISSION </FONT></CENTER>
<BLOCKQUOTE>
<FONT FACE="Times New Roman" SIZE="4" COLOR="#FFCC00">

Our Company is strongly committed to Clients, to Employees, to the Community and to the Environment. Quality is not our target, Quality is only our tool: our target is Excellence. Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, etc. etc.
</FONT></BLOCKQUOTE>
</BODY>

This will be rendered by the Browser as follows:

img

BLOCKQUOTE is a very handy Tag: remember it !
And, once again, please note how the FONT Tag has been used in the example above: within the CENTER Tag, as well as within the BLOCKQUOTE Tag.





other formatting tools : preformatting

As said before, the Browser doesn't understand formatting, it just displays text in a steady stream, unless you make appropriate use of the BR and P Tags and the &nbsp; Special Character.
So, for instance, this code:

<BODY BGCOLOR="#FFFFFF">


 x | o | x
- - - - - - -
 o | x | o
- - - - - - -
 x | o | x
</BODY>

would be displayed by the Browser as a continuously flowing string of text like this:

x | o | x - - - - - - - o | x | o - - - - - - - x | o | x

But with the <PRE> PREFORMAT Tag and, generally, on condition that a TT type of Font is used, it is possible to transform the Browser into a more human and friendly tool, and make it display our stuff the way we type it. For instance, this code:

img

would be displayed by the majority of Browsers like this:

img

and this code:

img

would be rendered like this:

img

REMARKS:

if(!window.JSFX)
	JSFX=new Object();
if(!JSFX.Browser)
	JSFX.Browser = new Object();

JSFX.Browser.mouseX = 0;
JSFX.Browser.mouseY = 0;

if(navigator.appName.indexOf("Netscape") != -1)
{
	JSFX.Browser.captureMouseXY = function (evnt) 
	{
		JSFX.Browser.mouseX=evnt.pageX;
		JSFX.Browser.mouseY=evnt.pageY;
	}

Huh, huh, heavy stuff this.....

And this is all for the PRE Tag.


And now


other formatting tools : the horizontal rule

This is a handy gadget, very useful to create a separation between two parts of a Document.

The STANDALONE TAG is: <HR>

Example:

<BODY BGCOLOR="#CCFF00">
Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla Blabla bla bla <HR>
Buh bu buhh bubuh buh bubuh bubuh Bubububh Buh bu buhh bubuh buh bubuh bubuh Bubububh Buh bu buhh bubuh buh bubuh bubuh Bubububh Buh bu buhh bubuh buh bubuh bubuh Bubububh etc. etc. etc.
</BODY>

The Browser will display this:

img

hot, hot, hot...
TIP
Horizontal Rules are made with pure HTML Code, which is nothing else than ASCII text, extremely low in Kb consumption.
Use Horizontal Rules instead of graphic Lines if you can: your Web Pages will download faster !

      As you can see, the HR Tag has obtained the effect of separating the "preceding" and the "following" string of text with a sort of horizontal, "shaded" line.
Pretty straight forward.

You may increase the vertical spacing between the upper and/or the lower text and the Horizontal Rule by introducing LINE BREAKS and PARAGRAPHS Tags in combination before and/or after the HR Tag. Test it by yourself.


With suitable ATTRIBUTES in the HR Tag we can control:


Some examples will clarify the issue. Look at this code:

<BODY BGCOLOR="#FF00FF">
<HR WIDTH="20">
<HR WIDTH="100">
<HR WIDTH="250">
<HR WIDTH="30%">
<HR WIDTH="60%">
<HR WIDTH="100%">
</BODY>

This is what your Browser will display:

img

COMMENTS AND CLARIFICATIONS:

And now, a bit of fun. Let's resize the Browser Window !!!
You should remember how to resize a Window [if not, look again at the tutorial (Enclosure 05) I gave you in Lesson 02].
So, play with this window, and make it narrower. You should get, in sequence, narrower windows, as follows:

img

Here you can see that the first 3 HR maintain the same width because of their absolute setting, while the last 3 are becoming narrower, but still proportional to the Browser Window Width.


img

The phenomenon is even more evident in the above Window.


img

Now the Window is so narrow that it cannot contain the full "solid" HR number 3 (from the top) with absolute setting: so the poor Browser does its best to still display it, but it must insert horizontal scrolling bars (which occupy some vertical space, so that, as a consequence, also vertical scrolling bars are inserted).
Yet, the last 3 HR (those with % settings) keep resizing proportionally to the Browser Window Width.


img

Things are really extreme here (in fact nobody will browse the Net at such a Browser Window Width, but I just want to show you the Browser mechanism....): the second and third HR (solid) cause the presence of scrolling bars while the 3 bottom HR keep resizing according to Window Width....

Obviously there is something to learn from this little game.
If you often surf the Net, I am sure you have come across several Web Sites that are a pain in the neck. Why ? Because, even at full screen Browser Window, you need to scroll left and right to see their content (be it text or images, or whatever else). Well, those Web Sites have not been designed very professionally.
The simple golden rule is: if you love your Web Site Visitors, make sure you won't give them any trouble of this sort (horizontal scrolling bars), because it is really annoying. A visitor that has to scroll left and right to visit a Web Site will very soon become very frustrated and surf away elsewhere !

So the professional Web Designer always tries to ensure that his or her Pages display well under any circumstance (read: under the most popular screen resolutions) with any Browser.
That's why I wanted you to play with Window resizing: this is a little trick you will have to use often to test your Pages - in fact I will come back to this point several times in this course.

By the way, the majority of those "pain in the neck" Web Sites have been made - guess how ? - with those famous wizards like MS Frontpage !
I have nothing against those Wizards, but this is what they may cause. You want to know why ? Simply because they "design" HTML code according to the Designer Computer settings, but ignoring completely Visitors and their Computers... Hoh, hoh, now you should start understanding things.
In conclusion, the Professional Web Designer may use those Wizards - but he or she should also know how to correct their likely deficiencies. For this, he or she needs to know HTML !!

Back to Horizontal Rules.
From what I said above, you may easily imagine how easy it would be to make a mistake with them.
Say you are designing your Page using a screen resolution of 800 x 600. You want to subdivide two strings of text with an HR, and you insert an HR 700 pixels wide (SIZE="700"). Which will display very nicely in your Browser at full screen Window (in fact even a 750 pixels HR won't cause horizontal scrolling bars).
But now think of your visitors: there are guys out there still browsing the Net with a screen resolution of 640 x 480. What will happen to them ? Even at full screen Browser Window they will get scrolling bars, and they will hate you !!!! Besides, also people having screen resolutions of 800 x 600 sometimes do not keep their Browser Window at full screen. So they might also get scrolling bars.

You might conclude that the only good method to adopt is that of the relative setting, with % instead of pixels....
NO, I am not saying that. In fact you might find absolute settings very useful sometimes (example: if you want HR between two images one on top of the other, and you want the HR to be exactly as wide as the image !).
What I am saying loud is that you should always design keeping in mind your visitors, and not your screen: resizing your Browser Window will make you understand the consequences of your choices, and sometimes you will have no choice at all ! Still, you will design knowing exactly what will happen to your Pages in certain circumstances, and you will be very alert, like a professional Web Designer should always be.

Wow, I am really exhausted, after this long speech, and I will say no more mainly because I will grab again this subject later on in this course.


Other examples of Horizontal Rules in action.

<BODY BGCOLOR="#FFFFCC">
<HR WIDTH="150" ALIGN="LEFT">
<HR WIDTH="150" ALIGN="RIGHT">
<HR WIDTH="150" ALIGN="CENTER">
<P>
<HR WIDTH="200" SIZE="1">
<HR WIDTH="200" SIZE="3">
<HR WIDTH="200" SIZE="8">
<HR WIDTH="200" SIZE="15">
<P>
<HR WIDTH="80%" SIZE="1" NOSHADE>
<HR WIDTH="80%" SIZE="3" NOSHADE>
<HR WIDTH="80%" SIZE="8" NOSHADE>
<HR WIDTH="80%" SIZE="15" NOSHADE>
</BODY>

The above code will be displayed like this:

img

Rather self-explanatory, I suppose, but still let's make some comments.

img

Are you feeling OK ?
I am sure you will feel better and better while we progress. Heh, heh...
In the meantime, I am certain you need a quick Exercise to recover from all the theory above. OK ?

Exercise 05
sayyes

Make a mini Web Page looking approximately like this one:

img

The solutions of this Lesson's Exercises are, as usual, in the next Lesson.

Saludos muchos !!!


Lesson 03go back to Lesson 03 - if you have already forgotten that stuff... shut-down this lesson ! go to next lesson - are you feeling so strong ?....Lesson 05



Plan of Lessons
welcome Module 1 - Lesson: 01 02 03 04 05 06 07 08 09 10
Module 2 - Lesson: 11 12 13 14 15 16 17 18 19 20
Module 3 - Lesson: 21 22 23 24 25 26 27 28 29 30



http://www.scodanibbio.com/webbuild


go to the top of this page

A simple Copyright statement:
You are granted a nontransferable, personal license to use this Course on one computer station.
You do not become the owner of the Course nor do you have the right to copy (electronically or by any other means), transfer to third parties, or alter any part, code or content of this Course.