Monday, January 29, 2018

HTML - Class 3 Tags (Line break, Centering Content, Horizontal Line, Non-Breaking Space)

Assalam u Alikum Guys, 

In this POST, we discuss some more HTML Tags Line break, Centering Content, Horizontal Line, Non-Breaking Space etc.


  • Line break (<br/>)

HTML break Tag use to insert a single line break and enable the next character starts from the next line. HTML break Tag start with <br/> but there is no ending Tag. Just use the <br/> Tag, onward text or element placed in next line. 

  • HTML's <br/> Tag is an Empty Tag.
  • Break Tag is useful for writing an Addresses or poems.
Example :


<p>hello <br/> How are you </p>

  • Centering Content (<center>)


HTML center Tag <center> is used to put any content or element in the center of the page. That centered the content only Horizontally.

  • HTML's center Tag is always begin with <center> and must be end with </center>. Carefully need or must be close the center Tag otherwise that put all remaining content horizontally align.
  • We can use That Tag but better idea is to align the elements /content in center is using CSS (center-align) that will in future POST's.
  • One of the drawback of <center> Tag is that is Not supported in HTML5.


Example :


<center>All that content aligned in center of page Horizontally.</center>

  • Horizontal Line (<hr/>)



In HTML Horizontal Line (<hr/>) Tag is used to Visually Break-up the section of HTML page or Web page. In another words, a horizontal line comes between the is sections.
or the document break in an HTML page or Web page.

  • The <hr/> tag must start with <hr/> but there is no ending Tag for <hr/> in HTML means that is an Empty element (Element that have no Ending Tag like : <br/> Tag ).
  • You can give Line between two paragraphs or some time used for underlining the text but that is not a good idea.
  • In HTML5, <hr/> Tag define a thematic break.
Example :


<p>This paragraph is above the Horizontal Line</p>
<hr/>
<p>This paragraph is above the Horizontal Line</p>


  • Non-Breaking Spaces (&nbsp;)



The non-breaking space is represented with &nbsp; it is a common character entity that used in HTML. means usually, HTML not allow the extra space between text or content of paragraph or other any other element so using &nbsp; we add spaces in our content.

or That is a space that will not break into a new line.

  • That is Like ordinary space that we used.
  • Ampersand (&) must add in start and Semicolon (;) must be placed at the end of &nbsp.

Example :


<p>This&nbsp;paragraph&nbsp;is&nbsp;above&nbsp;the&nbsp;Horizontal&nbsp;Line</p>
ResultThis paragraph is above the Horizontal Line


Thanks for paying attention !

ALLAH Hafiz and Take Care.......

Tutor : Asad Saleem

2 comments: