Bagaimana membuat: tabel perbandingan
- Halaman sebelumnya Tabel responsif
- Halaman berikutnya Video penuh layar
Belajar cara menggunakan CSS untuk membuat tabel perbandingan.
Fitur | Basic | Pro |
---|---|---|
Text contoh | ||
Text contoh | ||
Text contoh | ||
Text contoh | ||
Text contoh |
Bagaimana membuat tabel perbandingan
Langkah pertama - Tambahkan HTML:
<!-- Font Awesome icon library --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <table> <tr> <th style="width:50%">Fitur</th> <th>Basic</th> <th>Pro</th> </tr> <tr> <td>Text contoh</td> <td><i class="fa fa-remove"></i></td> <td><i class="fa fa-check"></i></td> </tr> <tr> <td>Text contoh</td> <td><i class="fa fa-check"></i></td> <td><i class="fa fa-check"></i></td> </tr> </table>
Kesadaran kedua - Tambahkan CSS:
/* Set table styles */ table { border-collapse: collapse; border-spacing: 0; width: 100%; border: 1px solid #ddd; } /* Set styles for table header and data */ th, td { text-align: center; padding: 16px; } th:first-child, td:first-child { text-align: left; } /* Striped table row */ tr:nth-child(even) { background-color: #f2f2f2 } .fa-check { warna: hijau; } .fa-remove { warna: merah; }
- Halaman sebelumnya Tabel responsif
- Halaman berikutnya Video penuh layar