Format Tags
To get blank lines and blank spaces to show up in your web browser, there are a few tags that will do that trick.
If you want to start a new line, simply use a line break tag, <br />.
<head>
<title> Learning HTML </title>
</head>
<body>
Woo-Hoo! <br /> I’m <br /> learning <br /> HTML!
</body>
</html>
If you want to start a new line and skip a line, you need to use the paragraph tags, <p></p>.
Most HTML tags are used in pairs, as we’ve seen with these tags, <html></html>, <head></head>, <title></title>, and <body></body>. Each of these tag pairs always have an opening tag and a closing tag, and the closing tag always has a /, or slash, in it.
HTML tags that aren’t used in pairs, like <br />, have the /, or slash, in them right before the > symbol.
Paragraph tags, or <p></p>, tell your internet browser to put a blank line before and after the text that you put between the paragraph tags. Whenever you want text to appear with a new line before and after it, you need to enclose that text in paragraph tags. Here’s an example.
<head>
<title> Learning HTML </title>
</head>
<body>
Woo-Hoo! <p>I’m</p> <p>learning</p> <p>HTML!</p> Am I
having fun?
I sure am!
</body>
</html>
To make more than one space between letters, you must use tag, which is called the non-breaking space tag. Notice that this tag does not need the angle brackets and it does not need an ending tag. This tag is a special tag because it starts with & (ampersand) and ends with ; (semicolon). In other words, the & tells the web browser that we are beginning a special character and the ; tells the web browser that we are ending a special character. What about the letters in-between? Well those letters are sort of an abbreviation for what the tag is telling the web browser to do. In this case it is telling the web browser to display an extra blank space. There are lots more of these special characters of which you should be aware.
Here is an example using the tag:
<head>
<title> Learning HTML </title>
</head>
<body>
Woo-Hoo! I’m learning HTML!
</body>
</html>
Things look a bit confusing right now? Relax and just try playing around with the various tags. Don’t worry about messing things up. I remember when I first started learning HTML. Boy, did I mess up my display! But hey, I sure did learn from my mistakes.
Finally, I want to let you know another way of breaking up your display beyond using the the line break tag, <br />, and the paragraph tags, <p></p>. What I am talking about is the horizontal rule tag, <hr />, which will insert a horizontal line on your web page.
<head>
<title> Learning HTML </title>
</head>
<body>
Woo-Hoo! <hr /> I’m learning HTML!
</body>
</html>
Wow! You have just learned a whole lot of new tags. However, there are still many more left for you to learn. Come on! Let’s keep going and I will show you some really cool stuff to do to your text!
This resource originally created by Deborah Dunk.
Revised and edited by Michael Galloway in 2005 & in 2006.