Dysan Posted December 28, 2007 Share Posted December 28, 2007 The following code, displays a basic 2x2 table. Why is the height of the table heading cells 22 pixels, even after I have declared them to be 19 pixels in height? How do I get the height of the table heading cells to be 19 pixels? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <style type="text/css"> body { background: url(plan.bmp) no-repeat; } table.coll { font-size: 8pt; font-family: "Verdana"; border-collapse: collapse; border: 1px solid rgb(138,188,1); } th { height: 19px; border: 1px solid rgb(138,188,1); background: url(bg.bmp); } </style> </head> <body> <table class="coll" border="1"> <tr> <th><input type="checkbox" name="checkbox" value="checkbox"></th> <th>First Name</th> <th>Last Name</th> </tr> <tr> <td><input type="checkbox" name="checkbox" value="checkbox"></td> <td>FirstName</td> <td>LastName</td> </tr> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/83432-set-table-heading-cells-height/ Share on other sites More sharing options...
mainewoods Posted December 28, 2007 Share Posted December 28, 2007 if you do not set table spacing and padding, ie will use a default values of 2. set them explicitly: <table cellpadding="0" cellspacing="0" class="coll" border="1"> that border setting may also cause you a problem because of the 'ie box model problem' Quote Link to comment https://forums.phpfreaks.com/topic/83432-set-table-heading-cells-height/#findComment-424461 Share on other sites More sharing options...
Dysan Posted December 28, 2007 Author Share Posted December 28, 2007 The table heading cells no get displayed at 21 pixels in height when view in IE6.0. How do I change the height to 19 pixels? Is it possible to get IE to behave kind of like FireFox, as FireFox display the table cells at the correct height? - Would changing the doctype help? If so what to? Also, how do I declare the cell padding and cell spacing using CSS? Quote Link to comment https://forums.phpfreaks.com/topic/83432-set-table-heading-cells-height/#findComment-424467 Share on other sites More sharing options...
mainewoods Posted December 28, 2007 Share Posted December 28, 2007 the thing to know about setting table padding and spacing using css is that the table tag and the td tags are separate entities in css. Also css uses the word 'margin' instead of 'cellspacing' <style> table { padding:0;margin:0; } /* set all tables */ td { padding:0;margin:0; } /* set all td's */ </style> the reason ff displays differently than ie is that ff will use default padding and margins of 0 if not specified and ie will use default values of 2px. Also border values used with an item that also has a width or height item will cause you to run into the 'ie box model problem' and it will dispay differently in ie and ff. Quote Link to comment https://forums.phpfreaks.com/topic/83432-set-table-heading-cells-height/#findComment-424637 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.