Markup p tag inside p tag?

<ins>status message
<p>type count

I read about whitch tags allowed inside p tags but I got confused. Above example is correct? or need to use br tag? I use p tags to no need br so start new line!


Hi @design, take a look at the answer in this StackOverflow page
It lists all the possible children element of a paragraph in the html5 specifications.
Among the list, p is not included, so you shouldn’t nest a p inside another p.

When you use the p tag, by default the element will be a block one. It means that what comes afterwards will be placed on a new line (as opposed to inline elements like <strong> or <img>). Usually the p element gets a default value for the margin-bottom that makes it separate from whatever comes next.

As a general rule, if the sentences after the new line starts are part of the same paragraph, use the <br> tag. If they are part of another paragraph, close the previous one and start another <p>.

Another thing, when you use the line break, don’t use it in order to create additional space. For that goal you can and should use, instead, the CSS properties for padding and/or margin. This will create a separation of concerns between the structure (given by the HTML) and the appearance (given by the CSS) of your file.

Happy coding!

1 Like