Re: Indenting text in a table cell

Discussion in 'HTML' started by dorayme, Sep 9, 2010.

  1. dorayme

    dorayme Guest

    In article <>,
    lrhorer <> wrote:

    > When I put an amount of text in a table cell, if the text flows past the
    > end of the cell, it of course wraps on additional lines. I can cause
    > the first line of the text to be indented by using the tag <td
    > style="text-indent: N">, where N is the size of the indent, but this
    > only causes the first line of the text to be indented. The remaining
    > lines are left justified right against the left edge of the cell, which
    > looks cramped. How can I get the remaining lines to be indented?
    > Actually, what I would like is to have the first line of the cell
    > indented a small amount and the remaining lines to be indented a bit
    > more.


    As I was reading the above I was sure you were going to say you
    wanted the first line of a paragraph indented a reasonable way
    and the rest not to look cramped but to be spaced away from the
    left edge of the cell wall. That would be the natural thing I
    imagined someone might want. And that would be so easy to do.

    But no! You want the rest to be indented even more than the first
    line. Well, luckily that is easy too. And there are a few ways to
    achieve this. This one amuses me suitably and generally looks
    like fun:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html;
    charset=utf-8">
    <title>Index</title>
    <style type="text/css" media="screen">
    td {border:1px solid; }
    p {
    padding: 0 0 0 2em;
    text-indent: -1em;
    }
    </style>
    </head>
    <body>
    <table>
    <tr>
    <td>
    <p>When I put an amount of text in a table cell,
    if the text flows past the end of the cell, it of course wraps on
    additional lines. I can cause the first line of the text to be
    indented by using the tag &lt;td style="text-indent: N"&gt;,
    where N is the size of the indent, but this only causes the first
    line of the text to be indented. The remaining lines are left
    justified right against the left edge of the cell, which looks
    cramped. How can I get the remaining lines to be indented?
    Actually, what I would like is to have the first line of the cell
    indented a small amount and the remaining lines to be indented a
    bit more.</p>
    </td>
    </tr>
    </table>
    </body>
    </html>

    --
    dorayme
     
    dorayme, Sep 9, 2010
    #1
    1. Advertising

  2. dorayme

    dorayme Guest

    In article <>,
    lrhorer <> wrote:

    > > td {border:1px solid; }
    > > p {
    > > padding: 0 0 0 2em;
    > > text-indent: -1em;


    >
    > That works, thanks! Actually, I like the results with
    >
    > padding: 0 0 0 2em;
    > text-indent: -1.5em;


    Yes, do tweak it however you like.

    Another way would be:

    td {border:1px solid; }
    p {
    margin: 0 0 0 2em;
    text-indent: -1.5em;
    }

    The mildly amusing part of this can be seen if you temporarily
    put a background colour on the paragraph element. <g>

    --
    dorayme
     
    dorayme, Sep 9, 2010
    #2
    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. RAB
    Replies:
    2
    Views:
    383
    Chris R. Timmons
    Nov 6, 2005
  2. news.rcn.com
    Replies:
    1
    Views:
    9,689
    Chris Smith
    Jul 12, 2004
  3. Phillip Roncoroni
    Replies:
    14
    Views:
    1,104
    Toby A Inkster
    Apr 5, 2004
  4. sdf
    Replies:
    3
    Views:
    1,922
  5. Scott Brookhart

    indenting text in a datagrid

    Scott Brookhart, Jul 23, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    166
    Scott Brookhart
    Jul 24, 2003
Loading...

Share This Page