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 Johansson, Jul 16, 2011
    1. Advertisements

  2. Tony Johansson

    Arne Vajhøj Guest

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

    Arne Vajhøj, Jul 16, 2011
    1. Advertisements

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

    Tony Johansson, Jul 17, 2011
  4. Tony Johansson

    Arne Vajhøj Guest

    You really should use it all the time.

    Not the 1995 style:

    This is paragraph 1.
    This is paragraph 2.

    but XML style:

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

    Arne Vajhøj, Jul 17, 2011
  5. Tony Johansson

    Brian Cryer Guest

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

    Axel Grude Guest

    use <p> when you want to create a block level element. There are an awful lot of
    "Programmers" who use this pattern instead:

    <td> .... content ... </td>

    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.

    Axel Grude, Jan 25, 2012
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.