If I have small amounts of text I need to add to a webpage, should they always be in <p>
tags? Or is it ok to just have them in a div occasionaly?
Text can either be placed by itself or in paragraphs, but it's generally bad practice to place text by itself. Later on, when you get onto styling and CSS, you'll be able to change your text's colours, fonts, size, etc. If your text is in a p tag, you know that you can tell CSS to make your desired changes to 'p'.
The <p> tag defines a paragraph of text. It is a block-level element and always starts on a new line. Before and after each paragraph, browsers add margin automatically.
The <p> tag defines a paragraph. Browsers automatically add a single blank line before and after each <p> element.
<div>
's should be used for layout and positioning purposes, not for storing text.
Using <p>
tags is semantically correct in this case - similarly, semantically correct pages tend to be ranked higher in search engines for various reasons (such as how effectively crawlers parse your website etc.).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With