Removing table lines and table space between cells in css

后端 未结 4 431
不思量自难忘°
不思量自难忘° 2020-12-17 17:21

I have this site: http://redditlist.com/dir/1026 and I\'m stuck on trying to remove spacing between cells so it will look more like this: http://redditlist.com.

相关标签:
4条回答
  • 2020-12-17 17:59

    Use the border-collapse CSS property to remove space between cells:

    table {
        border-collapse: collapse;
    }
    

    You see spacing between table cells by default because each cell has its own border, the cells don't share borders. This is called "the separated model", as explained in the Mozilla Developer CSS Reference:

    The separated model is the traditional HTML table border model. Adjacent cells each have their own distinct borders. The distance between them given by the border-spacing property.

    You can "remove" the spacing between the cells by making them share borders with each other, which is known as the "collapsed border model":

    In the collapsed border model, adjacent table cells share borders.

    0 讨论(0)
  • 2020-12-17 18:04

    try

    table td { display: table-cell; }

    0 讨论(0)
  • 2020-12-17 18:15
    table#myTable{
      border-collapse:collapse;
    }
    
    0 讨论(0)
  • 2020-12-17 18:15

    Try this

    table.className td
    {
        display: inline-block;
    }
    

    or

    table.className td
    {
        display: block;
    }
    
    0 讨论(0)
提交回复
热议问题