Search code examples
htmlcssborderpadding

CSS: padding-top without "stretching" border-left


I use a table with, of course, td.

For one td I use padding-top: 20px and border left:1pt

The result is that the border on the left side is "stretched" 20 too high now. I don't see a way to fix that. Do you have any idea? Thanks a lot!


Solution

  • Try using a span tag inside.

    <table>
      <tr>
       <td><span>Hello1</span></td>
       <td><span>Hello2</span></td>
      <tr>
    </table>
    

    Then apply CSS:

    <style>
      span {
        border-left: 1px solid black;
      }
    </style>