- Text Formatting:
text formatting
techniques. This part of html writing skills is the most important part of our whole web design
course. So you must learn it word by word.
Changing text font style
We can make a text bold, italic or underlined. If you want to make a text bold, you must inclose it
in <B>...</B> tags.
<BODY>
This is very <B> important </B>
</BODY>
In above text the word "important" is typed bold. You can make a text italic by inclosing it in
<I>...</I> tags.
And finally you can make some text underlined by inclosing it in <U>...</U> tags.
Example:
<HTML>
<HEAD>
<TITLE>Example 1, Lesson 2</TITLE>
</HEAD>
<BODY>
<B>This text is bold</B><br>
<I>While this one is Italic</I><br>
<U>and this text is underlined</U><br>
<B><I>Look at this, this is both bold and italic</I></B>
</BODY>
</HTML>
In above example you can see that how we can make a text both bold and italic or any other
combination.
You may notice the tag <BR> in the end of each line. Let's see what is this tag. If you insert enter
keys (new line characters) at the end of each line and wish that it will make new lines in your
output page you will soon be
disappointed.
All lines will be in a single line in output web page. No matter how html code is written in separate
lines. To break lines in output web page you must insert <BR> tags in breaking points. Also pay
attention that <BR> tag is one of few single tags in html language . It has not an ending tag.
Nested Tags
In previous section we saw a line of code with nested tags.
<B><I>This is both bold and italic</I></B>
When you use nested tags you must be sure that they do not overlap each other. They must be
nested exactly. For example some part of text may change to bold although it is not desired.
Text with fixed width font
As you may know, regular fonts use different horizontal space. For example letter 'w' uses more
space than the letter 'i'. Sometimes we need a font with exactly the same width for all letters . For
example if you want to make a table of numbers and you want the columns to be exactly under
each other in different rows, we will need this kind of text.
To specify this kind of text you must use <TT>...</TT> tags. TT means Typewriter Text.
Changing size and face of fonts
We can change face and size of fonts using <FONT>...</FONT> tags. Also using this tag alone will
not change the text. You need to use parameters for this tag. This parameters specify what kind of
change you need in text font.
Size of font
To change size of font in a part of text, inclose it with a <FONT> tag as below:
<FONT SIZE=n>...,</font>
n is size of font. size of font must be a number between 1 and 7. If you insert some text without
determining its size default size will be 3.
<HTML>
<HEAD>
<TITLE>Example 2, Lesson 2</TITLE>
</HEAD>
<BODY>
<FONT SIZE=1>1This text is bold</FONT><br>
<FONT SIZE=2>2This text is bold</FONT><br>
<FONT SIZE=3>3This text is bold</FONT><br>
<FONT SIZE=4>4This text is bold</FONT><br>
<FONT SIZE=5>5This text is bold</FONT><br>
<FONT SIZE=6>6This text is bold</FONT><br>
<FONT SIZE=7>7This text is bold</FONT><br>
</BODY>
</HTML>