Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a grid with no spaces using table html

I'm trying to build a grid in html but I want to remove spaces between my cells, and I can't find.

<table id="gameGrid" cellspacing="0" >
    <tr class="gridRow" >
        <td class="box" ></td>
        <td class="box" ></td>
        <td class="box" ></td>
    </tr>
    <tr class="gridRow" >
        <td class="box" ></td>
        <td class="box" ></td>
        <td class="box" ></td>
    </tr>
    <tr class="gridRow" >
        <td class="box" ></td>
        <td class="box" ></td>
        <td class="box" ></td>
    </tr>
</table>

and the CSS:

#gameGrid{
border:1px solid black;
border-collapse: collapse;
padding:0;
margin:0;
border-spacing: 0;
} 
#gameGrid .gridRow{
margin:0;
padding:0;
}
#gameGrid .gridRow .box{
margin:0;
padding:0;
background-color:green;
height:16px;
width:16px;
display:inline-block;
}

an example: http://jsfiddle.net/sLG2D/1/

I saw this post but nothing works How to remove unwanted space between rows and columns in table?

like image 409
Ajouve Avatar asked Mar 25 '23 01:03

Ajouve


1 Answers

Remove the display:inline-block; rule from #gameGrid .gridRow .box.

jsFiddle example

like image 165
j08691 Avatar answered Apr 02 '23 11:04

j08691