CSS - เซลล์ว่าง

คำอธิบาย

ว่างเซลล์ทรัพย์สินที่ใช้ในการแยกพรมแดนรูปแบบรูปแบบตารางในการควบคุมการแสดงผลของเซลล์ตารางที่ไม่มีเนื้อหาที่มองเห็น

ค่าที่เป็นไปได้

  • show - แสดงเส้นขอบของเซลล์ว่าง

  • hide - ไม่ได้วาดเส้นขอบของเซลล์ว่าง

นำไปใช้กับ

องค์ประกอบทั้งหมดที่มีการแสดงเซลล์ตาราง

ไวยากรณ์ DOM

object.style.emptyCell = "hide";

ตัวอย่าง

นี่คือคุณสมบัติเซลล์ว่างที่ใช้เพื่อซ่อนเส้นขอบของเซลล์ว่างในองค์ประกอบ <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>

สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ -


CSS ตอบสนอง

Language