Jump to content

Advanced css table: hide row


lindm

Recommended Posts

I have just discovered the wonderful world of advanced css for tables. This is my main table in a form:

<table class="tbl1">
<tr>
          <td>Row 1</td>
          <td><input name="field1" type="text" id="field1" value="0" /></td>
          <td><input name="field2" type="text" id="field2" value="0" /></td>
          <td><input name="field3" type="text" id="field3" value="0" /></td>
          <td><input name="field4" type="text" id="field4" value="0" /></td>
          <td><input name="field5" type="text" id="field5" value="0" /></td>
</tr>
</table>

 

The css I use to format the table is:

.tbl1 {table-layout: fixed; width:595px;}
.tbl1 td {text-align: left;} 
.tbl1 td+td {text-align: right;width:40px} 
.tbl1 td+td+td {text-align: right;width:72px;} 
.tbl1 td+td+td+td {text-align: right;width:72px}
.tbl1 td+td+td+td+td {text-align: right;width:72px}
.tbl1 td+td+td+td+td+td {text-align: right;width:72px}

 

I wonder if it is possible with css to hide the row (either in screen or print) if all the text fields have 0 as value? Today I have a php solution for this but a css solution would be nice.

Link to comment
https://forums.phpfreaks.com/topic/182948-advanced-css-table-hide-row/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.