Basic Tags
"Whitespace"
Try It: Add some text inside
Now we are finally ready to actually add some text to our page. You can do so
by just typing inside <body>
<body>
. Although text you type outside
of the <body>
tag may show up, doing so breaks the HTML
"rules".
Remember: Browsers ignore "whitespace".
will appear as:
You might notice that
no matter how many spaces, returns or tabs you type into your file, only
one space shows up when you see the page in the browser. Web authors
often call these types of characters (spaces, tabs, and returns)
whitespace.
<body>
This is some
text with spaces
</body>
This is some text with spaces
This may initially be frustrating, but HTML provides a number of tools
to allow you to lay out your text in almost any way you can think of.
The next section describes one of these, the <p>
tag. You will learn others in later lessons.
The <p>
tag
Try It: Use the
Try It: Try resizing your browser window
and see if it changes how your text wraps.
The <p>
tag inside <body>
and add some text to your page.
<body>
<p>My first
paragraph!</p>
</body>
<p>
tag is the first tag we have introduced
that goes inside the <body>
tag. In fact, all of
the tags you will learn about from here on only belong inside the
<body>
tag.
The <p>
tag is a container
tag that indicates that the text inside it represents a paragraph
of text. Most browsers display a paragraph by putting a blank line
before it and another one after. The text inside just wraps around from line
to line until the paragraph ends. Where the line wraps to the next line depends
on your font size, that is, the size of the letters,
in your browser as well as the size of your browser window.
Tip: Don't use the
Don't try and use the <p>
tag to create multiple blank lines.
<p>
to create multiple blank
lines. Many browsers do not create blank lines if your
<p>
is empty and there is another tag you will learn
next time that does just that!
End of Topic