P-end-tag (</p>) is not needed in HTML
P-end-tag is only required in XHTML, not in HTML.
Correct
But some times you have to close it any way eg. when you align the paragraph left/right/center.
Incorrect. The only time you need an explicit end tag is when you want to end the paragraph and immediately follow it by something that is allowed inside a paragraph (such as text or an inline element). This is usually a bad idea.
Would it for any reason be a bad idea to mix the usage of P-end-tag
Only that consistency is a virtue which aids in code maintenance.
HTML5 quote that makes it clear when p
can be omitted
Since this is why most Googlers must be coming here: 4.4.1 "The p element" https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element
Tag omission in text/html:
A p element's end tag can be omitted if the p element is immediately followed by an address, article, aside, blockquote, details, div, dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul element, or if there is no more content in the parent element and the parent element is an HTML element that is not an a, audio, del, ins, map, noscript, or video element, or an autonomous custom element.
Worth noting that a few other closing tags can also be omitted, e.g. li
: https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element
The full list can be found at 12.1.2.4 "Optional tags" https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
I don't recommend doing it however as others mentioned.
This HTML "feature" is one of the reasons why HTML5 is not a subset of XML.
History lesson
I was reading the history of HTML on Wikipedia, and when I reached the page about IBM Generalized Markup Language, which is a ~1970 predecessor to SGML, which is a predecessor to XML, which is a predecessor to HTML, when I saw this gem of a document sample:
:h1.Chapter 1: Introduction
:p.GML supported hierarchical containers, such as
:ol.
:li.Ordered lists (like this one),
:li.Unordered lists, and
:li.Definition lists
:eol.
as well as simple structures.
:p.Markup minimization (later generalized and formalized in SGML),
allowed the end-tags to be omitted for the "h1" and "p" elements.
The example is copied verbatim from the home page of one of the creators of GML.
So it is a bit funny how the world goes around. In the 70's people already wanted autoclose. Then it evolved into XML which is something saner that forbids autoclose. But then we got autoclose back in HTML. HAML template syntax also comes to mind. Also not how the tag names are identical as those in HTML (h1
, p
, ol
, li
).