There are some things you should be aware of with paragraphs and browsers.
By default, browsers will remove empty spaces from paragraph element blocks. This is true of spaces and extra empty lines. You need to be aware that you cannot change the output of your rendered HTML code by adding extra spaces or lines.
The following will both display as single line paragraphs after being rendered.
If you want to force a line break inside a paragraph, you can use the break tag. <br />
A horizontal rule is a line that runs across the browser window. These can be used to visually differentiate content in a document.
Please note that line breaks <br />
and horizontal rules <hr />
are known as ‘empty elements’. An ‘empty element’ only has one tag. Before the closing bracket of an empty element there will often be a space and a forward slash character. It is a good habit to get into writing these tags in this way.
You can use the pre element <pre>...</pre>
to tell a browser to render spaces and text exactly as you’ve typed.
This tag usually displays the contents of the element in a fixed-width font, as it is primarily used for preformatted code. However, it can also be used for preformatted text.
This is one method that could be used to present a poem in a browser while maintaining appropriate formatting.
Start getting prepared to complete Project 1, “My First Web Page!”, by selecting a poem, song lyrics, or long quote to worth with.