× Introduction HTML Editors Web Components Headings Paragraph Attributes Entities Images Comments Formatting Links File Paths Book Marks Image Links Unordered Lists Ordered Lists Tables Forms Other Form Elements Semantic tags Media Div and Span Examples Projects eBooks









HTML5 Paragraphs

In this tutorial you will learn how to create paragraphs in HTML.

Creating Paragraphs

Paragraphs are the most basic HTML element. Paragraphs are used in text content to read it easily and more readily understood. The HTML <p> element defines a paragraph.


Example:   Try It


<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

Each paragraph element is visually separated from the next one by the browser – typically leaving two empty lines between them.
With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.
The browser will remove any extra spaces and extra lines when the page is displayed.

Example:   Try It


<p>This is another       	 paragraph,     extra spaces 	will be removed by       browsers </p>

Result:

This is another paragraph, extra spaces will be removed by browsers


Inserting line breaks:

Text within a paragraph will normally automatically wrap to the next line when it meets the element’s edge, but it can be forced to wrap sooner by inserting a line break <br>tag.

The line break element causes the browse r to advance to the next line before displaying the nextelement or text on a web page. The line break tag is not coded as a pair of opening and closing tags.It is considered to be a <b> stand-alone or self-contained tag. </b>

Example:   Try It

<p>This is a paragraph <br> with line break.</p> 
<p>This is <br> another paragraph <br> with line breaks.</p>

Result:

This is a paragraph
with line break.

This is
another paragraph
with line breaks.


Separate paragraphs with a line:

To draw a line to separate paragraphs a horizontal rule <hr>tag can be inserted between paragraphs.

Example:   Try It

<p>This is a paragraph.</p>
<hr>
<p>This is another paragraph.</p>

Result:

This is a paragraph.


This is another paragraph.


Defining Preformatted Text:

Sometimes, using  , <br>, etc. for managing spaces isn't very convenient. Alternatively, you can use the <pre> tag to display spaces, tabs, line breaks, etc. exactly as written in the HTML file. It is very helpful in presenting text where spaces and line breaks are important like poem or code.

Example:   Try It

    
<pre> 
    Twinkle, twinkle, little star, 
    How I wonder what you are! 
    Up above the world so high, 
    Like a diamond in the sky.
</pre>

Result:

    Twinkle, twinkle, little star, 
    How I wonder what you are! 
    Up above the world so high, 
    Like a diamond in the sky.

Practice exercise:

1.Write an html code to display the web page as follows. View


Sri Hari Book Store

Mission

Sriharibookstore.com is committed to bringing the most convenient, easy and secure shopping experience on the web.

Products

10 Million Books across 20+ Languages, Audio Books, Gadgets & Accessories, Toys, Electronics, Mobiles & Tablets Accessories, Health Care Devices and Many More Stores.

Highlights

sriharibookstore.com has been awarded the most promising Start-Up company 2013.

The Most Prompt Customer Service & Support 2013-2014.

India's largest Book Warehouse - India Book of Records 2013 -2014.


2.Write an html code to display the web page as follows. View


Sri Ramanuja e-Patashala


New Media and Web Design

Sri Ramanuja Media Design will bring your company’s Web presence to the next level. We offer a comprehensive range of services .

Meeting Your Business Needs

Our expert designers are creative and eager to work with you.Take advantage of the power of Web!

Graphic design

When it comes to Graphic Design there are so many directions you can go. We’ve created our fair share of business logos and brand guidelines,
but one of our favorite styles continues to be bringing history to life with modern illustrations.

        Learning is not  
             the product of teaching. 
               Learning is the product of 
                          the activity of learners.