The <p> Tag
Paragraphs are use used as containers for raw text and inline elements. They cannot contain other paragraphs - or indeed, any other block element. The code for a paragraph element bears the form
<p>Text...Inline Element...Text...</p>Like any other element, paragraphs are amenable to CSS styling. The more useful attributes of <p> elements are listed below
- The
classattribute is discussed here. One can locally alter some aspects of the assigned style by defining an inline style using the codestyle="color:...". Needless to say, only those style attributes that require altering/adding need to be specified. - The
idattribute is discussed here. - The events available across all three browsers - Firefox, Opera and IE - are discussed here.
- The
styleattribute is used to assign inline CSS styling information to the element. The specification takes the formstyle="color:...". Inline styling should be used sparingly to temporarily override CSS attributes inherited from aclassspecification.
It is common practice to place raw text directly inside the body element. Browsers tend to be very fault tolerant and accept this. Nevertheless, this is wrong - raw text should always be wrapped in a <p>..</p> pair.
Finally, it should be noted that browsers ignore sequences of empty paragraph tags - as they do sequences of spaces and all carriage return characters.