Web Hosting Talk







View Full Version : to <p> or not to <p>.. that is the question.


seodevhead
04-15-2006, 10:12 AM
I use the <p> tag for all my paragraphs, but what do you guys use when you need to just say a couple words not attached to any paragraphs or content.. ie. "Advertise Here" or "Thanks to Sponsors".

I don't want to use a paragraph tag cause it ain't a paragraph... should I use just a div? Is there a tag specifically for this use? Thanks.

VisualZ
04-15-2006, 11:02 AM
well if its only two words but still a paragraph then use <p>

the_pm
04-15-2006, 12:36 PM
I know they taught us in elementary school that a paragraph must have at least two sentences, but if a thought stands alone with only one sentence or a couple words, it qualifies, and I would use <p> tags around it.

bluedreamer
04-15-2006, 12:57 PM
If it's only a couple of words then you could also justify using a <span class=""> tag?

the_pm
04-15-2006, 03:11 PM
If it's only a couple of words then you could also justify using a <span class=""> tag?Span doesn't actually define anything. It is simply a generic vessel that allows you to apply style to an object or text. If those few words are part of your content, which is defined as a set of paragraphs, those words are a paragraph as well.

If those words had a different function, such as a tagline or footer text, you might use the generic block-level element <div>, ID the text in such a way that you understand its purpose (<div id="tagline">), and create an appropriate style for it.

But regardless, all inline content (text, images and form elements), must be encased/defined by a block-level tag of some sort.

Amdac
04-15-2006, 03:11 PM
I guess I'm the only <br> fan, I rarely ever use <p>. :(

the_pm
04-15-2006, 03:38 PM
I guess I'm the only <br> fan, I rarely ever use <p>. :(The problem with <br> is that it doesn't define anything. When you define your paragraphs, it allows you to treat them properly and consistently using CSS. Also, some browsers have been known to ignore multiple <br> tags in a row, opting only to accept the first one they see (which is good behavior on their part). The only time I can see justification for <br> is when you have a natural break within a paragraph of text, such as writing out an address:
<p>My Name<br />
12345 My Street<br />
My City, ST, 12345</p>
That would be an appropriate time to use the <br>. Placing text underneath an image would be a good time as well, since the image and the text together form the complete thought:
<p><img src="my_image.jpg" alt="alternative text" /><br />
Text that accompanies or further explains this image.</p>

elekt
04-15-2006, 03:41 PM
i love teh br

bluedreamer
04-16-2006, 01:22 AM
Span doesn't actually define anything. It is simply a generic vessel that allows you to apply style to an object or text. If those few words are part of your content, which is defined as a set of paragraphs, those words are a paragraph as well.

yes very true, but seodevhead did say that the words weren't attached to paragraphs or content :)

the_pm
04-16-2006, 01:30 AM
Yes, he said this, and then he described words that would constitute a very short paragraph, despite his insistence that those words are neither paragraph-related or content (how could they not be content??). :)

But either way, <span> is not the proper way to go. If you don't feel you're defining a paragraph of text, then a <div> that is properly IDed is...proper.

bluedreamer
04-16-2006, 03:23 AM
he he, but then it all depends on what you define as "content" - the trouble with html is that there are sometimes too many ways of doing things :)

concretemonkey
04-16-2006, 06:40 AM
in this instance i would use the <br /> command. You could always use the <font class=""> command to define the font style if you are using CSS.

Since it is only just a few words, you probably won't need to define it as a paragraph as much.

I personally like to mix <p> and <br /> I know it is probably bad coding, but i find it works and is easier to manage, unless it is a bog set of text, then <p> is the best is suppose.

Website Rob
04-16-2006, 07:55 AM
I use the <p> tag for all my paragraphs, but what do you guys use when you need to just say a couple words not attached to any paragraphs or content.. ie. "Advertise Here" or "Thanks to Sponsors".

I don't want to use a paragraph tag cause it ain't a paragraph... should I use just a div? Is there a tag specifically for this use? Thanks.
To <p> or not to <p> is not the question, it is simply good form.

Presuming you are coding in XHTML, and hopefully your are, all Content must be enclosed within proper tags.
As bare words/sentences are "not" good form, when in doubt, use <p> </p>. ;)