Removing unwanted table cell borders with CSS

前端 未结 9 1046
灰色年华
灰色年华 2020-12-02 14:57

I have a peculiar and frustrating problem. For the simple markup:

相关标签:
9条回答
  • 2020-12-02 15:45

    You need to add this to your CSS:

    table { border-collapse:collapse }
    
    0 讨论(0)
  • 2020-12-02 15:45

    sometimes even after clearing borders.

    the reason is that you have images inside the td, giving the images display:block solves it.

    0 讨论(0)
  • 2020-12-02 15:48

    Modify your HTML like this:

    <table border="0" cellpadding="0" cellspacing="0">
        <thead>
            <tr><td>1</td><td>2</td><td>3</td></tr>
         </thead>
        <tbody>
            <tr><td>a</td><td>b></td><td>c</td></tr>
            <tr class='odd'><td>x</td><td>y</td><td>z</td></tr>
        </tbody>
    </table>
    

    (I added border="0" cellpadding="0" cellspacing="0")

    In CSS, you could do the following:

    table {
        border-collapse: collapse;
    }
    
    0 讨论(0)
提交回复
热议问题