HTML paragraphs
A paragraph always starts on a new line & usually a block element.
HTML Paragraphs
The HTML <p> element defines a paragraph.
A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.
Example:
<p>Adult education is essential for Democracy of India. The number of grown up illiterates is great. All college and senior School students should come forward to visit villages in the summer vacation. Each one will teach one there. This will remove illiteracy and strengthen our democracy.</p>
HTML Display
You cannot be sure how HTML will be displayed. Large or small screens, and resized windows will create different results. With HTML, you cannot change the display by adding extra spaces or extra lines in your HTML code. The browser will automatically remove any extra spaces and lines when the page is displayed:
Example:
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
HTML Line Breaks
The HTML <br> element defines a line break.
Use <br> If you want a line break (a new line) without
starting a new paragraph.
The <br> is an empty tag,
which means that It has no end tag.
Question
Can your write an html which gives an exact output that is being expected below?
Example:
“To be, or not to be: that is the question:
Whether ’tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them? To die: to sleep;
No more; and by a sleep to say we end The heart-ache and the thousand natural shocks
That flesh is heir to, ’tis a consummation
Devoutly to be wish’d.”
</p>
HTML <Pre> Element
The one solution for above problem can be using a <pre>
element.
The HTML <span> element defines
preformatted text.
The text inside a <pre> element
is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.
Example:
“To be, or not to be: that is the question:
Whether ’tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them? To die: to sleep;
No more; and by a sleep to say we end The heart-ache and the thousand natural shocks
That flesh is heir to, ’tis a consummation
Devoutly to be wish’d.”
<pre>