Remove all padding and margin table HTML and CSS

begiPass picture begiPass · May 7, 2013 · Viewed 302.2k times · Source

I have this table :

<body>
    <table id="page" >
        <tr id="header" >
            <td colspan="2" id="tdheader" >je suis</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
    </table>
</body>

and here is the css

html, body, #page {
    height:100%;
    width:100%;
    margin:0;
    padding:0;
}

#header {
    margin:0;
    padding:0;
    height:20px;
    background-color:green;
}

and I want to remove all margin and padding but always I have that :

enter image description here

How can I resolve this?

Answer

wroniasty picture wroniasty · May 7, 2013

Try to use this CSS:

/* Apply this to your `table` element. */
#page {
   border-collapse: collapse;
}

/* And this to your table's `td` elements. */
#page td {
   padding: 0; 
   margin: 0;
}