to home page

BWRS
SEARCH

HOMETUTORIALSLINKSFORUMGLOSSARYNEWS
 
PART 2

STEP BY STEP GUIDE
TO HTML - PART 2
ADDING TEXT

There are several different ways of altering the text structure. What follows is a guide to some of the things you can do. It is deliberately not complete and serves only as a starting point

Remember when setting the up to use the basic format described earlier

<html>
<head>
<title>your page title</title>
</head>
<body>
Your page material
</body>
</html>

Your text should go between the <body> tags
Note that HTML ignores carriage return, tab keys and more than one space in a row. It will also fail to recognise a lot of text characters like "&<>

So how do we alter the appearance of text when viewed on your browser

Either scroll down or select from below


Controlling how text wraps round and spaces

As we've already mentioned HTML ignore carriage return, tab keys and more than one space in a row.

For example if you insert this between your <body> tags

<body>
This will be all on one line
</body>

and

<body>
This
will
be
all on one line
</body>

will both appear as

This will be all on one line

Overall this is useful because it allows individual browsers to wrap text around to fit browser windows of different sizes. But it prevents you from separating lines out from one big paragraph as spaces and carriage returns.

However you can use 2 tags to do this <p> & <br>

The <p> tag stands for paragraph. it allows you to seperate out text paragrags with a line in between. The <br> tag represents a linebreak and ends the line but starts immediately below

for example

<body>
This is a complete example of what happens when you use the above tags in your HTML pages. If you choose to use the paragraph tag you get a ended paragraph with a space between the next as shown now<p>Where as the linebreak tag just stops and<br> starts again below</p>
<body>

This appears like so-

This is a complete example of what happens when you use the above tags in your HTML pages. If you choose to use the paragraph tag you get a ended paragraph with a space between the next as shown now.

Where as the linebreak tag just stops and
starts again below

Although you can use a </p> tag (and for good HTML you really should) most browsers (and hence web sites) don't need it. The same applies for the <br> tag (infact </br> is never seen)back to top

 


Special Characters

HTML coding does not recognize special characters (e.g. ù ) beyond basic ASCII text or worse can confuse browser (e.g. using < >)

These can be used however using character references

for example &#190; = ¾

They can be used as so

<body>
This is &#062; which is the greater than sign
</body>

appears as

This is > which is the greater than sign

A list can be found in our HTML reference library.back to top


Using Headings and content based tags

We've already seen the <h1> heading tag in operation. Infact there are 6 levels of headings <h1> to <h6>. Try using different ones within the <body> tags

e.g.

<h4>this is heading type 4</h4>
<h2>this is heading type 2</h2>

would appear as

this is heading type 4

this is heading type 2

In addition to the heading tags there are other so called content-based tags. These should be used to show certain features like definitions or citations

here are 3 try them within your document

<cite> this is for citations. It should appear in italics</cite>

this is for citations. It should appear in italics

<strong>Strongly emphasize text. Appears bold</strong>

Strongly emphasize text. Appears bold

<em>Emphasize text. It should appear in italics</em>

Emphasize text. It should appear in italics

There are many more. Some as you can see duplicate each other and you can do the same effect by individually altering font characteristics (see below). But try to use them. It means browsers recognize them for their content (i.e. it is a citation rather than simple text in italics)back to top

 


Altering font, size style etc. individually

There will be times when you want to alter the style of individual words for appearance sake. These are called PHYSICAL STYLE TAGS. We've already seen the <i> and </i> tags for italics. Here are some more

  • <b> for bold

  • <sub> for subscript

  • <u> for underlining.
    AVOID THIS ONE !!!!
    It is being removed gradually and leads to confusion with links

  • <big> increase the size of font
    you can use 2 to increase the size

    e.g. <big>big </big><big><big>bigger</big></big>

    big bigger

  • <small> reverse of big

Two other tags can also be used. Curiously, as they are both so useful they are being phased out !!!!

These are -

  • <basefont> can be used to set the whole document basic font attributes such as size (default is 3. Range is 1-7)

e.g. <basefont size = 7> sets the basic font size to 7

  • <font> allows you to adapt individual areas
e.g. <font size = +1> this text will be one fontsize bigger than basefont (</font> back basefont size)

This can also be done by setting the size attribute to a certain size
e.g. <font size =6> This is size six </font>

appears as

This is size six

You can also use <base font> & <font> for a whole lot more

You can also set colour of the base text font with color attribute

e.g. <font color = "#0000FF"> will set font colour to blue
where #0000FF is hexadecimal code for RGB colour blue


It can also be expressed in colour names.
There are 16 basic names defined by HTML 4.0 but many browser (but not all !!!) support extended colour names (100s of colours)

For example <font color = red> gives you red text

It is probably better to use <font> than <basefont> which will set all text including links to one colour
There are other attributes to indvidually set those

A list can be found in our HTML reference library.

  • You can also set the font style using the face attribute
e.g. <font face = "Arial"> this will be in arial if your browser supports it</font>

If you want you can give the browser a series of font options
e.g. <font face = "Comic Sans MS, Verdana, Arial">
If your browser supports Comic Sans MS it will appear if not, Verdana etc...</font>
The current philosophy & vogue is to use style sheets to replace <basefont> and it is likely in Future revisions of HTML standards that <basefont> and <font> will be replaced. These are discussed laterback to top

Aligning text

As you cant use spaces, tabs or other controls to determine text position on your document you must rely on a special attribute called align.

You can set this into your text like so

<h1 align = center> I'm big and in the middle </h1>
<p align = right>
I'm on the right
<p>
I'm back to normal

Which appears as

I'm big and in the middle

I'm on the right

I'm back to normal

Note you can put the align tag in any of these formatting tags (e.g. headers or start of paragraphs). At the end (or start of new <p> tag for example it resets to default align = "left".

Note browsers don't universally support justified


 

BACKBack- to basic principlesBack to Tutorial menunext - adding imagesNEXT
BASIC HTML MENU