Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When to use the p tag in html

10 views
Skip to first unread message

Tony Johansson

unread,
Jul 16, 2011, 5:42:17 AM7/16/11
to
Hello!

Can somebody give a good example when to use the p tag.
I know it's a paragraph

//Tony


Arne Vajhøj

unread,
Jul 16, 2011, 6:50:22 PM7/16/11
to
On 7/16/2011 5:42 AM, Tony Johansson wrote:
> Can somebody give a good example when to use the p tag.
> I know it's a paragraph

If you are sufficient XML oriented then you should have <p></p> around
all your text blocks.

Arne

Tony Johansson

unread,
Jul 16, 2011, 7:54:51 PM7/16/11
to

"Arne Vajhøj" <ar...@vajhoej.dk> skrev i meddelandet
news:4e2215ae$0$314$1472...@news.sunsite.dk...

I mean if it's only static text I don't need any p tag

//Tony


Arne Vajhøj

unread,
Jul 16, 2011, 10:02:06 PM7/16/11
to
On 7/16/2011 7:54 PM, Tony Johansson wrote:
> "Arne Vajhøj"<ar...@vajhoej.dk> skrev i meddelandet
> news:4e2215ae$0$314$1472...@news.sunsite.dk...
>> On 7/16/2011 5:42 AM, Tony Johansson wrote:
>>> Can somebody give a good example when to use the p tag.
>>> I know it's a paragraph
>>
>> If you are sufficient XML oriented then you should have<p></p> around
>> all your text blocks.
>
> I mean if it's only static text I don't need any p tag

You really should use it all the time.

Not the 1995 style:

This is paragraph 1.
<p>
This is paragraph 2.

but XML style:

<p>This is paragraph 1.</p>
<p>This is paragraph 2.</p>

Arne

Brian Cryer

unread,
Jul 18, 2011, 6:37:23 AM7/18/11
to
"Tony Johansson" <johansson...@telia.com> wrote in message
news:ivt8c7$t8n$1...@dont-email.me...

Then your page will not validate - http://validator.w3.org/
If your page does not validate then it might cause problems or not render as
you'd expect in some browsers, and bots might have problems. So, like Arne
has already posted, you should use them (correctly) all the time.
--
Brian Cryer
http://www.cryer.co.uk/brian

Axel Grude

unread,
Jan 25, 2012, 10:43:24 AM1/25/12
to
use <p> when you want to create a block level element. There are an awful lot of
"Programmers" who use this pattern instead:

<table><tr>
<td> .... content ... </td>
</tr></table>
(*)

A perfect candidate to replace with <p>

<p> .... content ... </p>

Alternatively, you can use <div>...</div> if you are intending to have some nested
elements in there (and not just flowing text). <P> just means its more or less plain
text contained.

(*) And yes, I am serious, I have seen this pattern time and time again. Countless
tables that contained just one cell, all because people didn't know how to create or
style block level elements.

Ax
0 new messages