Do you have to have <p>

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Simple question, when you have text on a web page do you have to have tags around it? I ask because when I have the p tags I get a big space above the word.

Roo's picture

She has: 840 posts

Joined: Apr 1999

You *should* have paragraph tags yes. It helps to keep text where it belongs and makes a page organized and neat.

You can specify space thought by using line height for the p tags in your css like so:

p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
line-height: 16px;
color: black;
}

Roo

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

You can also specify the space you are seeing above and below the paragraph with it's margins

p { margin: 0.5em; }

Busy's picture

He has: 6,151 posts

Joined: May 2001

is paragraph, is line break (new line)

one is equals to two 's

I personally always just use 's, never liked using for some reason

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Paragraphs are proper structure for paragraphs of text. It's like any other HTML element - use it properly! Using 's to make paragraphs is like using or to make headings, or as is oft discussed, using tables to make layouts. Works, but is incorrect. If you've got a bit of text that is not quite a paragraph I don't think it's so clear. If it's not a paragraph, what is it? Is it a heading? Is it a list? Use the tags that most accurately descirbe the element. Like Roo & Renegade said, you can then use CSS to fix the spacing.

They have: 161 posts

Joined: Jan 2005

BAH!

I've been using two tags to do the job. Meh..

I'm not changing it now. Sticking out tongue

Roo's picture

She has: 840 posts

Joined: Apr 1999

Ummm.... is XHTML where is HTML 4X....A isn't going to make two line breaks. As said above, you're better off using paragraph tags anyway.

openmind's picture

He has: 945 posts

Joined: Aug 2001

I'm getting into the habit now of using pr instead of br. Makes for a much better formatted page IMHO...

Roo's picture

She has: 840 posts

Joined: Apr 1999

pr??? Confused

openmind's picture

He has: 945 posts

Joined: Aug 2001

Roo wrote: pr??? Confused

I mean

I was having a brain fart when I wrote that...

demonhale's picture

He has: 3,278 posts

Joined: May 2005

I sometimes use , for some unique purpose... but most of the time, I wrap a paragraph in divs... (better to get accustomed to using )... Well its your choice anyways...

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

is one of those things that in the long run is the better way to do things. Combined with CSS, of course. isn't terrible, but if it is a paragraph, you're better off training yourself to use . It's more flexible when combined with CSS.

It can obviously be a pain to change your habits like that. I speak from experience, having only recently switched over to more properly coded HTML with CSS.

They have: 222 posts

Joined: Sep 1999

I usually create a class just for the first paragraph in a document that has the top margin set to -5px, that way I can use ... and not get the extra space above the first paragraph.

dataNdesigns's picture

He has: 79 posts

Joined: Jun 2005

a tag will give you much more flexability ongoing, the others are correct in saying you should try to use it, also you can use settings within the p tag when needed later.

I personally like them as it opens and closes as per XML and creates nice nesting. great for adding classes into as well. Moreover, you it will find it easier to use ongoing rather than 2 br's.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.