When to use the p tag in html

Discussion in 'ASP .Net' started by Tony Johansson, Jul 16, 2011.

  1. Hello!

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

    //Tony
    Tony Johansson, Jul 16, 2011
    #1
    1. Advertising

  2. Tony Johansson

    Arne Vajhøj Guest

    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
    Arne Vajhøj, Jul 16, 2011
    #2
    1. Advertising

  3. "Arne Vajhøj" <> skrev i meddelandet
    news:4e2215ae$0$314$...
    > 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
    >
    >
    >


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

    //Tony
    Tony Johansson, Jul 17, 2011
    #3
  4. Tony Johansson

    Arne Vajhøj Guest

    On 7/16/2011 7:54 PM, Tony Johansson wrote:
    > "Arne Vajhøj"<> skrev i meddelandet
    > news:4e2215ae$0$314$...
    >> 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
    Arne Vajhøj, Jul 17, 2011
    #4
  5. Tony Johansson

    Brian Cryer Guest

    "Tony Johansson" <> wrote in message
    news:ivt8c7$t8n$...
    >
    > "Arne Vajhøj" <> skrev i meddelandet
    > news:4e2215ae$0$314$...
    >> 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
    >>

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


    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
    Brian Cryer, Jul 18, 2011
    #5
  6. Tony Johansson

    Axel Grude Guest

    On 17/07/11 00:54, Tony Johansson wrote:
    > "Arne Vajhøj"<> skrev i meddelandet
    > news:4e2215ae$0$314$...
    >> 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
    >>
    >>
    >>

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

    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
    Axel Grude, Jan 25, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    2
    Views:
    403
    Malte
    May 10, 2005
  2. shruds
    Replies:
    1
    Views:
    709
    John C. Bollinger
    Jan 27, 2006
  3. Replies:
    1
    Views:
    356
    Andrew Thompson
    Nov 29, 2006
  4. Aniais
    Replies:
    5
    Views:
    573
    Joe (GKF)
    Dec 17, 2006
  5. Ton den Hartog

    when use ID and when use NAME in a HTML tag ??

    Ton den Hartog, Nov 30, 2003, in forum: Javascript
    Replies:
    9
    Views:
    123
    GIMME
    Dec 2, 2003
Loading...

Share This Page