New lines


br

When you want a new line, hitting enter in your HTML won't work:

I have been trying
To write a haiku for you
Some things I just can't do

I have been trying To write a haiku for you Some things I just can't do.

To get a new line, use the <br/> tag:

I have been trying<br/>
To write a haiku for you<br/>
Some things I just can't do

I have been trying
To write a haiku for you
Some things I just can't do.

Note that there is no </br> tag. This is because <br> is a self closing tag (or void element). This means that nothing goes inside of a <br> tag, so it closes itself by putting a slash at the end (like <br/>).

hr

Another self closing tag that makes a new line is the <hr/> tag. <hr> will also draw a horizontal line across the page:

I have been trying<hr/>
To write a haiku for you<hr/>
Some things I just can't do

I have been trying


To write a haiku for you
Some things I just can't do

p

One last way to make a new line is to surround blocks of text in paragraph tags, like this:

<p>Mr. and Mrs. Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much. They were the last people you'd expect to be involved in anything strange or mysterious, because they just didn't hold with such nonsense.</p>

<p>Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big, beefy man with hardly any neck, although he did have a very large mustache. Mrs. Dursley was thin and blonde and had nearly twice the usual amount of neck, which came in very useful as she spent so much of her time craning over garden fences, spying on the neighbors. The Dursleys had a small son called Dudley and in their opinion there was no finer boy anywhere.</p>

Mr. and Mrs. Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much. They were the last people you'd expect to be involved in anything strange or mysterious, because they just didn't hold with such nonsense.

Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big, beefy man with hardly any neck, although he did have a very large mustache. Mrs. Dursley was thin and blonde and had nearly twice the usual amount of neck, which came in very useful as she spent so much of her time craning over garden fences, spying on the neighbors. The Dursleys had a small son called Dudley and in their opinion there was no finer boy anywhere.


Challenge

Make a web page with a poem or haiku on multiple lines.


Solutions

Try this challenge on your own first, then come back here to see other people's solutions.

Try this challenge on your own first, then come back here to see other people's solutions.