4. Breaking it up into paragraphs
So far you have created and modified HTML documents, and you should
feel comfortable with the process of editing text and reloading it
into your web browser. So now relax for this fast lesson on
inserting paragraph breaks.
Objectives
After this lesson, you will be able to:
- Identify the paragraph break tag in HTML.
- Copy text from the web page and paste it in another document.
- Insert paragraph breaks into the text of your HTML document and
view the changes within your web browser.
Lesson
HTML Paragraph Breaks
We've seen earlier that a web browser will ignore all of the CARRIAGE
RETURNS typed into your text editor. But, wherever a browser sees the
paragraph tag, it inserts a blank line and starts a new
paragraph. The HTML code for forcing a paragraph break is:
<p>
Note that this tag is special in that it does not require an ending tag;
you do not need to use:
</p>
In a later lesson we will see an instance where the <p> tag does use a closing </p> but for the majority of your HTML work, it is not necessary.
Also note the <h> tags have a built in break so it is unnecessary to put <p> tag before a header tag:
<p>
<h2>Blah Blah Blah Blah</h2>
Inserting Paragraph Breaks
Note: If you do not have the working document from the previous
lesson, download a copy now.
Follow the directions below to insert and view a paragraph break in
your HTML document.
- Re-open your workspace (if not already opened).
- Go to the text editor window.
- Open your working document,
Volc.html
, in the text
editor (if not already opened).
- First we want to move the sentences ("A volcano is
.....") so that they are under the Introduction heading.
Use the mouse to cut and paste this text in the proper location.
- After these sentences, we want to add some more text. But rather than
re-typing this in, from this web page use your mouse to select and
copy the sentences:
Volcanoes have been a part of earth's history
long before humans. Compare the history of human
beings, a few million years in the making, to that of
the Earth, over four billion years in the making.
- Now, return to your HTML document in the text editor, and
paste this text after the existing sentences under the
<h2>Introduction</h2> heading.
- Save the changes in the text editor.
- Return to your web browser.
- If your working document is not visible, Use the Open
Local... command from the File menu to open the document.
- Select Reload from the File menu. You should now
see the two sentences of the Introduction. We now want to put a
paragraph break between these sentences.
- Again, return to your HTML document in the text editor.
- After the second sentence under <h2>Introduction</h2> (the one that ends " as a sticky, slow lava flow."), press RETURN (it is not necessary but it makes the HTML more readable as you work on it), and then enter the paragraph
tag:
<p>
This section should now look like:
<h2>Introduction</h2>
A volcano is a location where magma,
or hot melted rock from within a planet, reaches the surface.
It may happen violently, in a massive supersonic explosion,
or more quietly, as a sticky, slow lava flow.
<p>
Volcanoes have been a part of earth's history long before
humans. Compare the history of human beings, a few million
years in the making, to that of the Earth, over four
billion years in the making.
- Save the changes in the text editor.
- Return to your web browser and Reload the document. The two
sentences of the introduction should now be separate paragraphs.
Other types of breaks
To separate major sections of a web page, use the hard
rule or hr tag. This inserts a straight line like you
see right above the heading for this section.
The HTML format for a horizontal rule tag is:
<hr>
Let's try it now! Put an hr tag above the
Introduction heading. This will help to separate the
opening sentence of the lesson from the other portions that will
follow.
And finally, there is the <br> tag which forces text to a
new line like the <p> tag, but without inserting a blank line. You might use this tag
when making a list of items, when writing the lines of a poem, etc. Compare the differences between
using the <br> and <p> in these two examples:
Paragraph <p> tags Only |
HTML |
Result |
And then, we could all see
at once the brilliant purpose
of the paragraph tag.
<p>
Moving on...
<p>
the more tags you write,
the better you will feel?
|
And then, we could all see at once the brilliant purpose of the
paragraph tag.
Moving on...
the more tags you write, the better you will feel?
|
Paragraph <p> and Line Break <br> tags |
HTML |
Result |
And then, we could all see<br>
at once the brilliant purpose<br>
of the paragraph tag.
<p>
Moving on...
<br>
the more tags you write,<br>
the better you will feel?
|
And then, we could all see
at once the brilliant purpose
of the paragraph tag.
Moving on...
the more tags you write,
the better you will feel?
|
The <br> tag can be used for a different layout style for your section headings. If you notice, the header tags <h1>, <h2>, ... automatically insert white space above and below the text of the header tag. Some web page authors prefer a style that controls this white space.
Section titles with Header Tags |
HTML |
Result |
and in the end it was all
for naught.
<h4>The New Cheese Edict</h4>
Later, sir Longhorn declared
that all makers of cheese would
have to be certified before
commencing production.
|
and in the end it was all
for naught.
The New Cheese Edict
Later, sir Longhorn declared
that all makers of cheese would
have to be certified before
commencing production.
|
Section titles with <b> and <br> tags NOTE! The <b> tag is covered in the next lesson but all it does is make the text bold. |
HTML |
Result |
and in the end it was all
for naught.
<p>
<b>The New Cheese Edict</b><br>
Later, sir Longhorn declared
that all makers of cheese would
have to be certified before
commencing production.
|
and in the end it was all
for naught.
The New Cheese Edict
Later, sir Longhorn declared
that all makers of cheese would
have to be certified before
commencing production.
|
The difference may seem trivial now, but it opens up possibilities when later we learn to create text of different size and color for our section headings. For example, take a look at Web Pages That Don't Look Like Web Pages
Check Your Work
If you would like, compare your web page to this sample. If your document was
different from the sample, review how you entered the paragraph
break, <p>, into the text editor. Make sure you entered it as
instructed in the Inserting Paragraph Breaks section of this
lesson.
Review Topics
- What is the HTML tag for a paragraph break?
- What steps did you use for inserting a paragraph break in your
document?
- How did you display and view the changes in your web browser?
- * Extra Credit: What is a horizontal rule <hr> tag? a <br> tag?
Independent Practice
Use the paragraph, the horizontal rule, or the br tags to create
paragraphs or sections in your own document.
Coming Next....
Do you remember your first font?
How about adding Style... to your text.
Writing HTML Lesson 4: Breaking it up into paragraphs
©1995,1996,1997,1998
Maricopa Center for Learning and Instruction (MCLI)
Maricopa Community Colleges
The Internet Connection at MCLI is
Alan Levine --}
Comments to levine@maricopa.edu
URL: http://www.mcli.dist.maricopa.edu/tut/tut4.html