Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Media print multiple pages table-border-layout

When I print this, on the left and on the top of the table on the second page is missing the border. How can I fix this?

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8" />
    <style type="text/css">
        @media print
        {
            body { 
                margin: 0; 
                padding: 0;
                color: #000000 !important;
                background-color: #ffffff !important;
            }
            * {
                color: inherit !important; 
                background-color: transparent !important;
                background-image: none !important;
            }
            table {
                width: 100%;
                border: 1pt solid #000000;
                border-collapse: collapse;
                font-size: 11pt;
            }
            #space { height: 750px; }
        }
    </style>
</head>
<body>
    <br /><br />
    <h2>.</h2>
    <div id="space"></div>
    <table border="1">
        <thead>
            <tr><th>Amount</th><th>label</th></tr>
        </thead>
        <tbody>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
            <tr><td>20</td><td>pineapple</td></tr>
        </tbody>
    </table>
</body>
</html>
like image 734
sid_com Avatar asked Sep 12 '11 06:09

sid_com


1 Answers

Change your table style to have something looks good :

table {
    border: 1pt solid #000000;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11pt;
    width: 100%;
}

Edit : To have something looks perfect, first, remove all table border then define each style with what you want, in order to have only one line by border (create border for th, td, tr) :

table {
    border-collapse: separate;
    border: 0px solid #000000;
    border-spacing: 0;
    font-size: 11pt;
    width: 100%;
    border-color: #000000 ;
    border-right: 1px solid;
}

tr {
    border-color: #000000;
    border-style: none;
    border-width: 0;
}

td {
    border-color: #000000;
    border-left: 1px solid;
    border-bottom: 1px solid;
}

th {
    border-color: #000000;
    border-left: 1px solid;
    border-top: 1px solid;
    border-bottom: 1px solid;
}
like image 50
Jean-Charles Avatar answered Nov 04 '22 05:11

Jean-Charles