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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.