06. HTML Paragraphs

HTML Paragraphs

Most Browsers automatically add an empty line before and after paragraph

HTML Line Breaks

<br/> element is an empty HTML tag.

<html>
<body>
<p>This is <br/> a para- <br/> graph with line breaks</p>
</body>
</html>

In XML and future versions of HTML, HTML elements with no end tag (closing tag) are not allowed.
Even if <br> works in most browsers, writing <br/> instead is more future-proof and thus considered best practice.

HTML Output Tips

Resized windows will create different result.
You cannot change the output by adding extra space or extra lines in your HTML code.
The browser will remove extra space and extra lines when the page is displayed.
Any number of lines count as one space, and any number of spaces count as an one space

<html>
<body>
<p>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.
</p>
<p>
Note that your browser ignores your layout!
</p>
</body>
</html>


<html>
<body>
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains                a lot of spaces
in the source              code,
but the              browser
ignores it.
</p>

<p>
The number oflines in a paragraph depends on the size of your browser window.
If you resize the browser window, the number of lines in this paragraph will change.
</p>
</body>
</html>

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams