skip to Main Content

Is there a way to reduce more spacing and padding in my html table cell?

#table1 td {
  font-size: 200px;
}
<table id="table1" border="1">
<tr><td>1</td></tr>
</table>

enter image description here

Also at https://jsfiddle.net/3x2Lgytd/

2

Answers


  1. table 
    {
        border-collapse: collapse;
    }
    

    will collapse all borders separating the table columns…

    or try

    <table cellspacing="0" style="border-spacing: 0;">
    

    do all cell-spacing to 0 and border spacing 0 to achieve same.

    #table1 td {
      font-size: 200px;
    }
    
    #table {
      border-collapse: collapse;
      border-spacing: 0;
    }
    <table id="table1" border="1" cellspacing="0">
      <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
      </tr>
      <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
      </tr>
      <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
      </tr>
    </table>
    Login or Signup to reply.
  2. The space you’re referring to is coming from the way the type/text is set, as well as space built into the glyph itself. You can reduce the line-height of the text to remove some space above and below a line of text.

    td {
      font-size: 200px;
      line-height: 0.8;
    }
    <table border="1">
      <tr>
        <td>1</td>
      </tr>
    </table>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search