DEV Community

Cover image for The difference between the P tag and the PRE tag in HTML
TidyCoder
TidyCoder

Posted on

The difference between the P tag and the PRE tag in HTML

Hey, This day we will understand the difference between the p and the pre tags. Firstly, what is the rule of these two tags?

These two tags are used to write paragraphs in HTML language, but the difference between the first and second tags, is how are treat the content of text.

The P tag removes the useless spaces, and remove the returns to line, but if you want to return to line, you can use the
tag.

The PRE tag not removes the returns to line and the spaces, but if the width of his parent reduce, his width don't reduce.

For this the PRE tag is not adaptable, but the P tag add returns to line to reduce his width if is necessary.

Here a complete example to illustrate this:

Top comments (0)