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:

123 Hickory Way<br>
Chicago, IL<br>

123 Hickory Way
Chicago, IL

Span Syntax Example:

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

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

Runnable Paragraph Example Code:

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

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: