Learn HTML Paragraphs





Part 1


In HTML5 we use the < p > tags to define a paragraph


Code Example:

                
                
                <p>a paragraph.</p>
<p>another paragraph.</p> 
                
                
            
Try yourself >>







Part 2

HTML Paragraph closing tag


In most modern browser, HTML paragraph will be display correctly even if you forget to close the tag, but it is best practice to always use closing tag


Code Example:

                
                
                <p>No closing tag 
                  <p>With closing tag</p>
                
                
            
Try yourself >>








Part 3

HTML Visibility


Adding extra spaces in HTML lines will not effect the line:


(check the code editor, we added spaces inside)


Code Example:

       
       
       <p>
FreeCodeWiki
learn html online free
best html tutorial
html coding course
</p>
       
       
   
Try yourself >>

With all the screen sizes available in the market, Along with the various browsers, HTML may be displayed diffrenetly for each computer, But the difference is minor








Part 4

HTML Line Breaks


When we need to break a line without starting a new paragraph, the < br > element can be used


Code Example:

        
       <p>
       <p>Free<br>Code<br>Wiki</p>
</p>
        
   
Try yourself >>






Part 5

HTML < pre > Element


The < pre > Allows us to control the text in the way that we can preserve spaces and line breaks easily: (You may use that element to display code lines in HTML paragraph.)


Code Example:

        
       <pre>
       document.getElementById("test1").innerHTML = "1";
       document.getElementById("test2").innerHTML = "2.";
       document.getElementById("test3").innerHTML = "3.";
document.getElementById("test4").innerHTML = "4.";
</pre>
        
   
Try yourself >>











FreeCodeWiki is the best way to learn html, our main goal is to create easy way to learn html coding for beginners and above

Navigation