CSS - sel kosong

Deskripsi

The kosong-sel properti digunakan dalam terpisah-perbatasan Model tata letak meja untuk mengontrol rendering dari sel tabel yang tidak memiliki konten yang terlihat.

Nilai yang Mungkin

  • show - Batas sel kosong ditampilkan.

  • hide - Batas sel kosong tidak digambar.

Berlaku untuk

Semua elemen dengan tampilan sel tabel.

Sintaks DOM

object.style.emptyCell = "hide";

Contoh

Berikut adalah properti sel kosong yang digunakan untuk menyembunyikan batas sel kosong di elemen <table>.

<html>
   <head>
      <style type = "text/css">
         table.empty {
            width:350px;
            border-collapse:separate;
            empty-cells:hide;
         }
         td.empty {
            padding:5px;
            border-style:solid;
            border-width:1px;
            border-color:#999999;
         }
      </style>
   </head>

   <body>
      <table class = "empty">
         <tr>
            <th></th>
            <th>Title one</th>
            <th>Title two</th>
         </tr>
      
         <tr>
            <th>Row Title</th>
            <td class = "empty">value</td>
            <td class = "empty">value</td>
         </tr>
      
         <tr>
            <th>Row Title</th>
            <td class = "empty">value</td>
            <td class = "empty"></td>
         </tr>
      </table>
   </body>
</html>

Ini akan menghasilkan hasil sebagai berikut -


Language