Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div table-row Border?

Tags:

html

I am attempting to create a table-like structure using divs on my site but am having some difficulty with borders. I'd like there to be a horizontal line separating each row but using border on a div set to table-row seems to have no effect. What am I doing wrong? Thanks for your help!

<div class="table">
    <div class="row">
        <div class="cell">
        <p>Blah blah</p>
        </div>
        <div class="cell">
        <p>Blah blah</p>
        </div>
        <div class="cell">
        <p>Blah blah</p>
        </div>
    </div>
</div>

.table {
    display: table;
    width: 100%;
}

.row {
    display: table-row;
    border-bottom: 1px solid black;
}

.cell {
    display: table-cell;
    width: 33%;
}
like image 811
Vecta Avatar asked Apr 04 '11 18:04

Vecta


2 Answers

You can also add border-collapse: collapse to .table if you want to set border in the .row.

like image 187
theblang Avatar answered Oct 13 '22 00:10

theblang


You can apply your border-bottom property to the cell class instead of row class.
Here is a fixed demo: http://jsfiddle.net/WXCa6/

like image 28
LostLin Avatar answered Oct 13 '22 01:10

LostLin