 
Programming
& construction
|
|
WYSIWYG editors
(in development)
|
Interactivity & animation
(in development)
|
Web applications
(in development)
|
Implementation
(in development)
|
 |
Text formatting
Heading Commands
Heading commands are used extensively in HTML documents to create headings.
There are six (6) heading commands: <H1> through <H6>. <H1>
is the largest and <H6> is the smallest. Here are their relative sizes:
<H1>This is Heading 1</H1>
<H2>This is Heading 2</H2>
<H3>This is Heading 3</H3>
<H4>This is Heading 4</H4>
<H5>This is Heading 5</H5>
<H6>This is Heading 6</H6>
Heading commands create bold, sized text, with space beneath, as shown above.
Fonts or Typefaces*
* It should be noted that the <font> tag is deprecated, and as such
it is preferable to apply text attributes through a Style
sheet.
While you may add a typeface attribute to a <font> tag,
eg: <font face="Arial ">
the fonts that you specify must be available on the computer of the person
browsing the page, or the typeface will revert to whatever is the default display
font for the local browser.
To maximise the chances of your page displaying with the correct
typeface, you should:
- select a commonly available typeface, which is viewable on all platforms.
- provide alternative similar typefaces, with a generic option (eg:
sans serif)
- select the typeface for legibility on a computer screen (sans-serif is best)
- eg:<font face="Verdana, Arial, Helvetica, sans-serif ">
Font Size Commands*
To control font size in the body of the text, the <FONT> tag with a SIZE
attribute may be used. The font size attributes available are:
1 to 7, -1 to -7 and +1 to +7
Sizes 1-7 are absolute sizes, while the plus and minus
sizes are relative to the default font. The code is written like this:
<FONT SIZE="+3">This is +3</FONT>
<FONT SIZE="+1">This is +1</FONT>
<FONT SIZE="-1">This is -1</FONT>
<FONT SIZE="-3">This is -3</FONT>
When setting font sizes it should be kept in mind that:
- Different browsers on different platforms render font sizes quite differently
- test your font sizes before publishing
- Font sizing, like other font attributes, may be more efficiently set in style
sheets (see Style sheets).
- Inline font tags override any font attributes in style sheets settings.
Aligning Text
By default in HTML, text is justified to the left of the screen.
To set text alignment add an attribute to the <p> paragraph tag, eg:
<P ALIGN="right">Text in here is pushed to the right</P>
<P ALIGN="center">Text in here is centred on screen</P>
<P ALIGN="left">Text in here is pushed to the left</P>.
The <DIV> tag
The block level <DIV> tag is a way of dividing the document into blocks
for individual formatting. It may be used to apply alignment and many other attributes
(such as Style sheet information) to larger blocks of content, eg:
<div align="center">
<p>This text is aligned in the centre of the screen </p>
<p><img src="Image1.jpg" width="300" height="208"></p>
<p>so is this image</p>
</div>
(See Page layout for more about the DIV tag)
White space
Spaces and line breaks need to be explicitly stated
Use the <br> tag for starting a new line without a paragraph break and
the character (non-breaking space), for adding more than
a single space between characters in your text.
Eg:
|
In the code:
|
|
Rendered by the browser:
|
|
One green bottle
|
=
|
One green bottle
|
|
One green bottle
|
=
|
One green bottle
|
|
One green bottle
Two green bottles
|
=
|
One green bottle Two green bottles
|
|
One green bottle<br>Two green bottles
|
=
|
One green bottle
Two green bottles
|
Now find out about using images >
|