css中的關於empty-cells的問題

來源:互聯網
上載者:User
發現在css中,當把border-collapse設定為separate為,要不要empty-cells結果是一樣的,而且用show與hide值都一樣,望各位指點。

在css2標準中
文法:

empty-cells : show | hide

取值:
show : 預設值。顯示邊框
hide : 隱藏邊框

說明:
設定或檢索當表格的儲存格無內容時,是否顯示該儲存格的邊框。
只有當表格行和列的邊框獨立(例如當 border-collapse 屬性等於 separate )時此屬性才起作用。
對應的指令碼特性為 emptyCells 。

這是個css2的標準 不為IE所支援,在Firefox中可以正常顯示效果,具體效果的示範代碼如下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>table test</title><style>#layout {}.show {border: 1px solid #ff0000; border-collapse:separate; empty-cells: show;}.hide {border: 1px solid #ff0000; border-collapse:separate; empty-cells: hide;}</style></head><body><table id="layout">  <tr>    <td class="show">Cascading</td>    <td class="show"></td>  </tr>  <tr>    <td class="hide">Cascading</td>    <td class="hide"></td>  </tr> </table></body></html>

可以看到 show的時候 空表格被顯示出來,hide的時候 空表格被隱藏

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.