locked
separate padding for top of table-cells? RRS feed

  • Question

  • User632751675 posted

    hi,

    I have a table that has table-cell elements in it.  I need to have one of the table-cells have a slightly different padding-top. Each time I apply a padding-top, both table-cells are affected. I tried wrapping this element inside a div, but it doesn't work.  How do I achieve this?

    Wednesday, April 11, 2018 6:43 PM

All replies

  • User-1838255255 posted

    Hi maggiemays,

    According to your description and needs, i make a test in my side, i am not clear if meet your needs, please check code:

    <head>
        <meta charset="utf-8" />
        <title></title>
        <style>
            #cellval {
            display:table-cell;
            padding-top:20px;
            }
            table {
            border:1px solid red;
            }
        </style>
    </head>
    <body>
        <table>
            <tr>
                <td>111</td>
                <td>222</td>
                <td id="cellval">333</td>
            </tr>
        </table>
    </body>

    If not meet your needs, please share your code and needs(image format) for us to check. 

    Best Regards,

    Eric Du 

    Thursday, April 12, 2018 5:23 AM