简体   繁体   中英

How do I remove the vertical padding in a div table-cell?

Take this web example into account (it seems to have the same issue) I have the following CSS on my website (note the space between the #head and #body <div>'s ):

#body {
        display: table;
        border-spacing: 0;
        border-collapse: collapse;
}

#body-row {
        display: table-row;
        margin: 0;
        padding: 0;
}

.column-left, .column, .column-right {
        display: table-cell;
        padding: 0px;
        border: dotted 2px #89E;
}

.column-left, .column-right {
        width: 190px;
        font-size: .95em;
}

However, this still adds a space between the very top and bottom of the table-cell. Padding and margin do no seem to do anything for this. Advice?

.column-left, .column, .column-right {
    vertical-align: top; /* add vertical align top to fix this issue */
    display: table-cell;
    padding: 0px;
    border: dotted 2px #89E;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM