3 Text in HTML

3.1 Lines and Paragraphs

A paragraph in HTML is anything enclosed by <p>...</p>. You should always remember to end the paragraphs with the end tag </p>.

Browsers display text in a paragraph with a single space between the words, and a new line whenever necessary. The browser will ignore any extra space or blank lines in the HTML source, so it doesn't matter how the source document is set out.

Sometimes you might want to end a line early, or have a blank line to separate out the content, and you can do this with the <br> tag. As the <br> tag causes a line break immediately rather than defining a region, there is no need for an ending tag.

(Note that if you have multiple consecutive <br> tags the browser is only required to produce one line break, so this is not a good way to create extra vertical space even if it works for some browsers.)

3.2 Headings

You might want to have headings on your page to use as titles for pages, sections etc. There are six styles of heading defined in HTML:

<h1>...</h1>

Heading 1

<h2>...</h2>

Heading 2

<h3>...</h3>

Heading 3

<h4>...</h4>

Heading 4

<h5>...</h5>
Heading 5
<h6>...</h6>
Heading 6

Exactly how these various headings will appear is left up to the browser, but they will always be ordered in diminishing importance such that <h1>...</h1> is the most significant (usually the largest) and <h6>...</h6> the least significant.

Exercise 3

Add a large heading to your page, followed by a short paragraph explaining who you are. Be sure to include the fact that you are studying (or working) at the University of York. It should end up looking something like this.


Previous page Next page