Text in <div> tags

I was watching a CSS video from lynda.com and the instructor showed this:

<div id="mainBanner">Welcome to the so and so Museum</div>

What caught my attention was that he had text inside of a <div> tag. I know that this will render correctly, but is it semantically correct? Shouldn’t text always be wrapped inside of a tag that denotes text, like a <p> tag?

What do you guys think? Have you ever placed text inside of a <div> tag?

Have you ever placed text inside of a <div> tag?

Yep, it’s perfectly fine, and often a good idea. Small bits of text often are not a paragraph, anyhow. I find this setup is good for things like a logo.

Echoing what ralph just said; It is perfectly in fact THE semantic way for a myriad of situations: logos, mottos , single lines of text( tho I feel that that could go either way), etc.

Also, consider the fact that it’s not valid place form elements directly on a form ( and that sometimes you don’t need/want to do use a fieldset). It is in fact preferable to use a P instead of a DIV in that case as well.

It is in fact preferable to use a P instead of a DIV in that case as well.

Are label-input pairs a paragraph? Though I notice the original decade-old specs at w3.org still show p’s in forms, at least a div is specifically saying, semantically, that there are no semantics to that tag at all.

Like Matt I’m also uneasy with zero-semantic elements wrapping text fragments. I still often use p’s for fragments, falling back to the way some dictionaries are totally okay with paragraph not even needing to be a full sentence.

When using a div, you’re basically saying “I, web developer, need a block element here.” Which often is the reason we use divs.

No, it’s not really preferable to place P in place of fieldset in a normative language. Actually the W3C had other such silliness in their 4.01 form examples, for example: <FORM action=“…” method=“post”><P><FIELDSET><LEGEND>Personal Information</LEGEND> I don’t think they thought it through enough. Only in the loosest sense “some” data would fit the P.