Web Authoring

    Topic 5 –
 Text Formatting
Objectives
Students should able to:
Describe the function and use the
following text formatting tags:
       •   Paragraphs
       •   Headings
       •   Emphasis
       •   Line breaks
       •   Bold
       •   Italic
       •   Image source (Img Src)
Paragraph
The <p> tag defines a paragraph.
This tag places a blank line above and
below the text of the paragraph.
The web browser automatically
understands how to display the text
because of the paragraph tag.
 Example:
       <P> ... the text goes here ... </P>
Headings
The HTML header contains several
notable items which include:
1. doctype - This gives a description of the
type of HTML document this is.
2. meta name="description" - This gives a
description of the page for search engines.
3. title - Defines the name of your document
for your browser.
Headings
The header in our example document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
 <html>
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-
8859-1">
<meta name="description" content="Comprehensive
Documentation and information about HTML.">
 <meta name="keywords" content="HTML, tags, commands">
<title>The CTDP HTML Guide</title>
 <link href="style.css" rel="stylesheet" type="text/css">
</head>
Emphasis
If you learned HTML before you learned
XHTML, you probably know about the bold
and italics tags.
But these tags are not semantic elements
because they define how the text should look
rather than information about the text.
They have been generally replaced by strong
(for bold) and emphasis (for italics).
Emphasis
Example:

<em>This text is emphasized</em> most
browsers display it as italics.

<strong>This text is strongly
emphasized</strong> most browsers display
it as bold.
Link Break
Line breaks are different from most of the
tags we have seen so far.
A line break ends the line you are
currently on and resumes on the next
line.
Placing <br /> within the code is the same
as pressing the return key in a word
processor. Use the <br /> tag within the
<p> (paragraph) tag.
Link Break
For example:

<p> Will Peterson<br />
Box 61<br />
Cleveland, Ohio<br />
</p>
Font
The <font> tag is used to add style, size,
and colour to the text on your site.
Use the size, colour, and face attributes
to customize your fonts.
Use a <basefont> tag to set all of your
text to the same size, face, and colour.
Font
Example: - set font size to 5

<p> <font size="5">Here is a size 5
font</font> </p>

Example: - set font colour to red
<p><font color="red">This text is red</font>
</p>
Underline
Underlines can be used to highlight and
emphasize text on web pages.
Text can be underlined using CSS style
sheets, with the text-decoration property, or,
with the HTML U element.
Example:

    <U> ... text to be underlined ... </U>
Preformatted Text
Preformatted text between the start and
end PRE tag is rendered using a fixed
with font, in addition whitespace
characters are treated literally.

The spacing and line breaks are rendered
directly.
Preformatted Text
For example, a verse from Shelley (To a
Skylark):

<PRE> Higher still and higher
         From the earth thou springest
      Like a cloud of fire;
         The blue deep thou wingest,
And singing still dost soar, and soaring ever
singest.</PRE>
Using <style> Tag
The <STYLE> tag is always inside the
header of the document, i.e. between the
<HEAD> Start and End Tags.

<HEAD>
    <TITLE>Bach's home page</TITLE>
    <STYLE type="text/css">
         H1 { color: blue }
    </STYLE>
</HEAD>

Web topic 5 text formatting

  • 1.
    Web Authoring Topic 5 – Text Formatting
  • 2.
    Objectives Students should ableto: Describe the function and use the following text formatting tags: • Paragraphs • Headings • Emphasis • Line breaks • Bold • Italic • Image source (Img Src)
  • 3.
    Paragraph The <p> tagdefines a paragraph. This tag places a blank line above and below the text of the paragraph. The web browser automatically understands how to display the text because of the paragraph tag. Example: <P> ... the text goes here ... </P>
  • 4.
    Headings The HTML headercontains several notable items which include: 1. doctype - This gives a description of the type of HTML document this is. 2. meta name="description" - This gives a description of the page for search engines. 3. title - Defines the name of your document for your browser.
  • 5.
    Headings The header inour example document: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso- 8859-1"> <meta name="description" content="Comprehensive Documentation and information about HTML."> <meta name="keywords" content="HTML, tags, commands"> <title>The CTDP HTML Guide</title> <link href="style.css" rel="stylesheet" type="text/css"> </head>
  • 6.
    Emphasis If you learnedHTML before you learned XHTML, you probably know about the bold and italics tags. But these tags are not semantic elements because they define how the text should look rather than information about the text. They have been generally replaced by strong (for bold) and emphasis (for italics).
  • 7.
    Emphasis Example: <em>This text isemphasized</em> most browsers display it as italics. <strong>This text is strongly emphasized</strong> most browsers display it as bold.
  • 8.
    Link Break Line breaksare different from most of the tags we have seen so far. A line break ends the line you are currently on and resumes on the next line. Placing <br /> within the code is the same as pressing the return key in a word processor. Use the <br /> tag within the <p> (paragraph) tag.
  • 9.
    Link Break For example: <p>Will Peterson<br /> Box 61<br /> Cleveland, Ohio<br /> </p>
  • 10.
    Font The <font> tagis used to add style, size, and colour to the text on your site. Use the size, colour, and face attributes to customize your fonts. Use a <basefont> tag to set all of your text to the same size, face, and colour.
  • 11.
    Font Example: - setfont size to 5 <p> <font size="5">Here is a size 5 font</font> </p> Example: - set font colour to red <p><font color="red">This text is red</font> </p>
  • 12.
    Underline Underlines can beused to highlight and emphasize text on web pages. Text can be underlined using CSS style sheets, with the text-decoration property, or, with the HTML U element. Example: <U> ... text to be underlined ... </U>
  • 13.
    Preformatted Text Preformatted textbetween the start and end PRE tag is rendered using a fixed with font, in addition whitespace characters are treated literally. The spacing and line breaks are rendered directly.
  • 14.
    Preformatted Text For example,a verse from Shelley (To a Skylark): <PRE> Higher still and higher From the earth thou springest Like a cloud of fire; The blue deep thou wingest, And singing still dost soar, and soaring ever singest.</PRE>
  • 15.
    Using <style> Tag The<STYLE> tag is always inside the header of the document, i.e. between the <HEAD> Start and End Tags. <HEAD> <TITLE>Bach's home page</TITLE> <STYLE type="text/css"> H1 { color: blue } </STYLE> </HEAD>