Forum Moderators: not2easy
Sorry, for the newbie question, but it is a common practice or recommended to use this :
<div>
My Text Here!
</div>
Instead of :
<div>
<p> My Text Here! </p>
</div>
The question really is, if it is valid to display text directly in a div (I see it in the browser), but I wonder about other repercussion, like for example, being seen for a search engine?
Remember that <p> for styling purposes behaves exactly like <div> - it's a standard block level element.
Using <p>, would cause a space between the title and the box drawn by the div.
[edited by: fischermx at 8:51 pm (utc) on April 13, 2005]
Remember that <p> for styling purposes behaves exactly like <div> - it's a standard block level element.
Yes, it is a "standard block element", but "behaves exactly like" may be a bit misleading. Browsers do not treat them precisely the same --unless told to do otherwise, they add a top margin before the <p>, a bottom margin after the block.
fishermx,
if the default margins are your reason for using<div> instead of <p> remember that you can define a style for <p> that removes the margin (it isn't actually an "extra linebreak"). Alternately, you can create a class for any paragraphs you wish to style differently from the rest, and adjust the margins for that class however you wish.