Sometime ago I read somewhere that one single line of text is considered a paragraph, therefore valid to be placed into a <p>
element that "represents a paragraph/block of text".
Browsing around this is confirmed by some examples that I've just found:
http://www.w3.org/wiki/HTML/Elements/p#Example_A
http://reference.sitepoint.com/html/p
In my particular case I am making a <form>
that includes some validation messages for each field and that are only meaningful to the user once they interact with the page.
For positioning purposes (<p>
is a block element) would be easier to use <p>
elements for these messages, but since <span>
is a more generic and meaningless element I could use it too with "display:block"
but I am not sure if I should do this instead.
Could you tell me what is the element to be used in this case?.
Thanks!
The HTML5 spec defines that the p
element "represents a paragraph", and a paragraph is defined as:
A paragraph is typically a run of phrasing content that forms a block of text with one or more sentences that discuss a particular topic, as in typography, but can also be used for more general thematic grouping. For instance, an address is also a paragraph, as is a part of a form, a byline, or a stanza in a poem.
No-one can generally answer if you should use p
or not, this depends on each particular case, and also your understanding of the content.
Now, if you think p
may not be appropriate, why do you want to go with span
when you are looking for a block element? Just use div
instead.