emptyCells style property
8 | ||||
Note: The emptyCells property is supported in Internet Explorer from version 8.
If you want that the border and background of an empty cell will be visible in earlier versions of Internet Explorer, a possible solution is to place a whitespace ( ) into the cell.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: empty-cells |
Possible values:
The type of this property is string.
One of the following values:
Borders and backgrounds are drawn. | |||||||
Borders and backgrounds are not drawn. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Borders and backgrounds are drawn. |
Default: show.
Example HTML code 1:
This example illustrates the use of the empty-cells property:
|
||||
<head> <style> .hideEmpty { empty-cells: hide; } .showEmpty { empty-cells: show; } </style> </head> <body> Hide empty cells: <table class="hideEmpty"> <tr> <td width="10" bgColor="#00b900"></td> <td>Pear</td> </tr> <tr> <td width="10" bgColor="#d24015"></td> <td>Cherry</td> </tr> </table> <br /><br /> Show empty cells: <table class="showEmpty"> <tr> <td width="10" bgColor="#00b900"></td> <td>Pear</td> </tr> <tr> <td width="10" bgColor="#d24015"></td> <td>Cherry</td> </tr> </table> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the emptyCells property in JavaScript:
|
||||
<head> <script type="text/javascript"> function ChangeEmptyCells (selectTag) { // Returns the index of the selected option var whichSelected = selectTag.selectedIndex; // Returns the text of the selected option var selectState = selectTag.options[whichSelected].text; var table = document.getElementById ("myTable"); table.style.emptyCells = selectState; } </script> </head> <body> <table id="myTable"> <tr> <td width="10" bgColor="#00b900"></td> <td>Pear</td> </tr> <tr> <td width="10" bgColor="#d24015"></td> <td>Cherry</td> </tr> </table> <br /> Modify emptyCells property: <br /> <select onchange="ChangeEmptyCells (this);" size="4"> <option />hide <option selected="selected" />show <option />-moz-show-background <option />inherit </select> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
empty-cells (MSDN)
empty-cells (Mozilla Developer Center)
empty-cells (Safari Reference Library)
empty-cells (W3C)
empty-cells (Mozilla Developer Center)
empty-cells (Safari Reference Library)
empty-cells (W3C)
User Contributed Comments