Home > Software engineering >  HTML indentatinon in table
HTML indentatinon in table

Time:02-05

My HTML code looks like this:

<style type="text/css">
<!--
    td.indent    {text-indent:10mm; }
//-->
</style>

[...]

<table>
    <tr>
        <td > Long line of text </td>
        <td > Some other text </td>
    </tr>
</table>

And the output text in the table is indented as expected:

              Long line of text

However, when I try to add line breaks with <br>:

<td > Long line of<br> text </td>

Only the part before <br> is indented:

              Long line of
text

How can I get the output to look like this?

              Long line of
              text

CodePudding user response:

You can use padding-left instead of text-indent.

td.indent {
  padding-left: 10mm;
}
<table>
  <tr>
    <td > Long line of<br> text </td>
  </tr>
</table>

  •  Tags:  
  • Related