Adding our first sentence to our web pages

Lesson 2

Now that we have our html, head, title and body tags in place, it's time to add our first sentence.

We let our page know that we are adding a something by using a paragraph tag. <p>

The Rule of thumb is that every opening tag must also have a closing counterpart. Paragraph tags are an exception to that rule.

When your code sees your second paragraph tag, it will assume that the first one has ended.

Please make a space in your code UNDER the opening body tag. Remember, everything that will be seen on a web page is placed between the body tags.

Add your paragraph tag.

Follow your paragraph tag with the sentence that you would like to add.

<p>This is my first sentence.

Save your notepad and refresh your browser.

You will now be able to see your sentence on your page.

Your code does NOT care WHERE your text is positioned in notepad. It sees the instructions and follows them. After the last word of your sentence please add another paragraph and your second sentence.

<p>This is my first sentence.<p>This is my second sentence.

Save and refresh.

WHOA!

Even though your code has BOTH sentences on the same line, they are displayed in your browser as two separate lines. Why?

Because you have added a paragraph tag at the beginning of your second sentence.

Lets experiment with this a little more.

Please place your two sentences on different lines in notepad and remove the second paragraph tag. Save and refresh.

UMM do you see what I see?

Even though they are typed  on different lines in notepad, they are displayed as one line in your browser. Why?

We removed the second paragraph tag. Your code needs to see a <p> so it will know that the second sentence belongs in a new line.

Lets add the <p> at the beginning of the second sentence again. Save and refresh.

There...now are sentences are on two separate lines again.

Lets center the first sentence. We do this by adding an additional bit of instruction to your paragraph tag. These extra tag instructions are called statements. We will add the statement align=center.

The align=center statement is part of the paragraph tag and is placed within the < and the >

Your paragraph tag should now look like this

<p align=center>

Save and refresh.

If your first sentence is centered and your second sentence is not....

DANCE!

Please center your second sentence, save and refresh.

Keep dancing if both of your sentence are centered now.