Re: Indenting text in a table cell

D

dorayme

lrhorer said:
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>
 
D

dorayme

td {border:1px solid; }
p {
padding: 0 0 0 2em;
text-indent: -1em;
[/QUOTE]
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>
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top