I often come across webpages where, instead of using a separate <div>
element to add specific styles, a <p>
tag is used.
I would be interested in knowing:
<p>
tag or a <div>
tag?<p>
tag? Does it have anything to do with inheritance?Which is the semantically proper way to add styles
There isn't one. Semantics and styles are largely orthogonal considerations. They are related only in so far as most of the time you will want to present semantic information to the reader in a consistent way.
Write semantic markup, then write CSS that describes how you want it to look.
What are the advantages of using a
<p>
tag?
It defines a paragraph. (A <div>
defines a block with no associated semantics).
Does it have anything to do with inheritance?
No.