HTML Paragraphs


In order to write content in the form of text in HTML, you would use the paragraph tag, <p></p>. Within the paragraph tag, you can include other HTML elements such as the anthor tag, <a href=""></a>, or you can define a paragraph by assigning it an id. You would assign the paragraph an id after the first "p" in the paragraph tag. Below is how you would write out the paragraph tag in HTML code and how it would be outputted in the browser based on the different scenarios.



Paragraph tag with plain text:



Code:


<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.</p>

Output:


Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.



Paragraph tag with an anchor tag embedded within it



Code:


<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. <a href="/index.html" target="_blank">Homepage</a> Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.</p>

Output:


Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. Homepage Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.



Paragraph tag with an id to define it sepecifcally:



Code:


<p id="intro-paragraph">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.</p>

Output:


Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dolorum id enim recusandae modi accusantium. Ex architecto, quis unde quisquam necessitatibus perspiciatis. Distinctio non sed similique commodi rerum voluptatem, optio libero.



Note: When giving an HTML element an id, that id usually plays a role in how that element is displayed or the functionality of the element based on the rest of the HTML document's CSS or JavaScript.