lindm Posted November 25, 2009 Share Posted November 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
haku Posted November 26, 2009 Share Posted November 26, 2009 CSS has no way of knowing what the contents inside the tags are, so unfortunately no, you cannot d that with CSS. Quote Link to comment Share on other sites More sharing options...
FaT3oYCG Posted November 26, 2009 Share Posted November 26, 2009 PHP is probably the best solution for that problem, you could use java script but that can be disabled on the user side where as PHP is server side which generates the html. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.