Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a table with horizontal line only

Tags:

html

css

How can I build a table in HTML and CSS only with the horizontal lines? I've tried so much stuff but I cant get it to work.

Something like this:

Name (space) Age


Andre (space) 12


Jose (space) 16


like image 825
aconstancio Avatar asked Jan 04 '14 01:01

aconstancio


2 Answers

Potentially like this (jsfiddle):

table {
    border-collapse: collapse;
    width: 100%;
}

tr {
    border-bottom: 1px solid #ccc;
}

th {
    text-align: left;    
}

<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Age</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Jose</td>
            <td>25</td>
        </tr>
        <tr>
            <td>Alberto</td>
            <td>32</td>
        </tr>
    </tbody>
</table>
like image 163
Josh Beam Avatar answered Oct 14 '22 10:10

Josh Beam


the css for the horizontal dividers is:

th, td {
  border-bottom: 1px solid #ddd;
}

see: https://www.w3schools.com/css/css_table.asp

like image 24
Deatk Avatar answered Oct 14 '22 08:10

Deatk