2013-05-06 16:33, Ian Yang wrote:
But when
you use <p> element purely as container, is that really a semantic
approach?
No, and there is very little semantics in HTML in general. The word
"semantic" as usually used as a buzzword really refers to structure, not
semantics (meaning).
In reality, both in HTML tradition and in HTML5 drafts, the <p> element
means a block of text that may contain text-level markup, but not other
markup. It largely corresponds to the word processor concept of
paragraph, except that the latter is even wider: anything formatted as a
block is a paragraph.
When some text and text-level markup needs to be marked up as a block,
there are usually two basic options: <p> and <div>. In special cases,
other markup may apply (e.g., <blockquote> or <li> or <td>), but this
depends on context.
The real differences between <p> and <div> are:
1) <p> implies empty lines before and after, in default rendering, and
may cause (short) pauses before and after in speech rendering
2) <div> content is not limited to text-level markup but can contain
e.g. a list or a table.
It's pointless to try to describe the difference in more "semantic"
terms, or even in more structural terms. Such descriptions just result
in confusion, endless questions, and debate.
Of course you *can* ignore difference 1 if you think that non-CSS
rendering does not matter, on the grounds that you can set vertical
margins in CSS as desired. Then it would be natural to use <p> for all
basic blocks of text (i.e., blocks that contain only text and text-level
markup).
And "block" can be seen as a physical concept, which makes things
easier, or as a logical concept, in which case your would need to refer
to things like dealing with a specific topic as a logical unit, such as
one passage (paragraph) in a novel, a collection of interrelated data,
or a unit of a form consisting of a label and associated field.
Things would probably be easier if the word "paragraph" were not used at
all (except perhaps when referring to paragraphs of prose) and <p> were
defined as denoting a block of text.
--
Yucca, http://www.cs.tut.fi/~jkorpela/