Home Snippets Projects Donate

Get Snippets For:

   Java    HTML/CSS JavaScript

Paragraphs and Line Breaks

Code Description:

The <p> tag is used to write a paragraph, or any block of text for that matter. Line Breaks are created within a paragraph with the <br> tag. Line Breaks will go to a new line in a paragraph and is useful for cases such as poetry and addresses. Line Breaks do not have a closing tag. Do NOT use Line Breaks to start new paragraphs or to add spacing to the beginning or end of a paragraph. If you need to set a style for a specific phrase or word in a paragraph, you can add the <span> tags around it and add the CSS to it.

Basic Paragraph Syntax:

<p>This is a paragraph</p>

This is a paragraph

Line Break Syntax Example:

<p>
123 Hickory Way<br>
Chicago, IL<br>
60106
</p>

123 Hickory Way
Chicago, IL
60106

Span Syntax Example:

<p>
My favorite color is <span style="color: limegreen">green</span> because it reminds me of nature!
</p>

My favorite color is green because it reminds me of nature!

Runnable Paragraph Example Code:

<!DOCTYPE html>
<html>
    <head>
        <title>Paragraph Example</title>
    </head>
 
    <body>
	<p>Paragraph Example Text...</p>
    </body>
</html>

How to Run This Code:

Simply paste this code into a plain text file with the ".html" extension and save it. You will then be able to open it in the web browser of your choice.

Related Links: