I want to align "User ID" label right side to make it closer to it's value, see pic. below.
Seems can't solve this with additional colspan's. User ID can contain 1-9 digits.
<center>
<table id="customer_info">
<tr>
<td><img id="logo" src="img/logo.png" align="middle"></img></td>
<td colspan="2">User ID</td>
<td>011238</td>
</tr>
<tr>
<td colspan="3">Items to get:</td>
<td>390 s.</td>
</tr>
<tr>
<td colspan="3">Complete until:</td>
<td>21.1.2013</td>
</tr>
</table>
</center>
<hr />
table {
white-space: nowrap;
border: none;
width: 250px;
height: 50px;
border-spacing: 0px;
color: #806E66;
font-family: "Arial";
font-size: 14px;
text-shadow: 0 0 1px rgba(0,0,0,0.1);
}
#customer_info tr > td:last-child {
text-align: right;
font-weight: bold;
font-size: 16px;
color: #E36608;
}
#customer_info tr:nth-child(1) > td:nth-child(2) {
text-align: right;
font-size: 12px;
}
because you have all the table cells connected together and depends on each other width
to solve this one solutions is to do the following:
<center>
<table id="customer_info">
<tr>
<td colspan="3" align="right">
<table width="100%"><tr><td><img id="logo" src="img/logo.png" align="middle"></img></td><td align="right">User ID</td><td align="right">011238</td></tr></table></td>
</tr>
<tr>
<td colspan="2">Items to get:</td>
<td width="100%" align="right">390 s.</td>
</tr>
<tr>
<td colspan="2">Complete until:</td>
<td align="right">21.1.2013</td>
</tr>
</table>
</center>
<hr />
hope this helps
See Working Demo
HTML
<center>
<table id="customer_info">
<tr>
<td width="30%">
<img id="logo" src="img/logo.png" align="middle" />
</td>
<td width="15%"> </td>
<td style="text-align:right" width="30%">
User ID
</td>
<td width="30%">
011238
</td>
</tr>
<tr>
<td colspan="3">
Items to get:
</td>
<td>
390 s.
</td>
</tr>
<tr>
<td colspan="3">
Complete until:
</td>
<td>
21.1.2013
</td>
</tr>
</table>
</center>
<hr />
CSS
table {
white-space: nowrap;
border: none;
width: 250px;
height: 50px;
border-spacing: 0px;
color: #806E66;
font-family: "Arial";
font-size: 14px;
text-shadow: 0 0 1px rgba(0,0,0,0.1);
}
#customer_info tr > td:last-child {
text-align: right;
font-weight: bold;
font-size: 16px;
color: #E36608;
}
#customer_info tr:nth-child(1) > td:nth-child(2) {
text-align: right;
font-size: 12px;
}
Related
I'm creating an e-mail template to send out but for some reason, I am unable to create two simple columns in the footer area.
Layout:
Code:
<div style="width: 100%; height: 100%;">
<table style="margin: 0px auto 0px auto; padding: 20px 20px 20px 20px; font: normal 10.5px; color: #777777; width: 100%; height: 100%;" align="center">
<tbody>
<tr>
<td>
<table class="content" style="background: none repeat scroll 0% 0% #FFFFFF; box-shadow: 0px 1px 2px rgba; width: 600px; max-width: 600px; margin: 0px auto;" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
<thead>
<tr style="display: inline-block; width: 100%; background: #1F1F1F;" bgcolor="#1F1F1F">
<td style="width: 100%;" align="left" valign="middle">
<h1 style="padding: 15px 15px 15px 15px; color: #FFFFFF;">Test</h1>
</td>
<td style="border-left: 1px solid #FFFFFF;" align="right">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-decoration: none; color: #ffffff; text-align: center; padding: 15px 15px 15px 15px; border-bottom: 1px solid #FFFFFF; font-family: Helvetica, Arial, Verdana; font-size: 8px; letter-spacing: 1.5px;">test</td>
</tr>
<tr>
<td style="text-decoration: none; color: #ffffff; text-align: center; padding: 15px 15px 15px 15px; font-family: Helvetica, Arial, Verdana; font-size: 8px; letter-spacing: 1.5px;">test</td>
</tr>
</tbody>
</table>
</td>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<h4 style="color: #27ccc0; text-align: center; padding: 15px 15px 0px 15px;"> </h4>
</td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td>test</td>
<td>test</td>
</tr>
</tfoot>
</table>
</td>
</tr>
</tbody>
</table>
How do I modify the above code to create two simple columns in the footer area, that is still within the e-mail's container?
You should make simple structure of html,
Don't make table in table. You can use rowspan. HTML <th> rowspan Attribute
cells in thead tag, recommend to use th tag HTML <thead> Tag
Don't use this style display:inline-block; on tr tag
Put color style on tr tag if cells doesn't have different color
<div style="width: 100%; height: 100%;">
<table class="content" style="background: none; box-shadow: 0px 1px 2px rgba; width: 600px; max-width: 600px; margin: 0px auto;" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
<thead>
<tr style="width: 100%; background: #1F1F1F;color: #FFFFFF;">
<th style="width: 100%;" align="left" valign="middle" rowspan=2>
<h1 style="padding: 15px 15px 15px 15px;">test</h1>
</th>
<th style="border-left: 1px solid #FFFFFF;border-bottom: 1px solid #FFFFFF;text-decoration: none;text-align: center; padding: 15px 15px" align="right">
test
</th>
</tr>
<tr style="width: 100%; background: #1F1F1F;color: #ffffff; ">
<th style="border-left: 1px solid #FFFFFF;text-decoration: none; text-align: center; padding: 15px 15px" align="right">
test
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
<tr>
<td style="background: red;" colspan="2">
<h4 style="color: #27ccc0; text-align: center; padding: 15px 15px 0px 15px;"> </h4>
</td>
</tr>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
</tbody>
<tfoot>
<tr style="width: 100%; background: #1F1F1F; color: #ffffff;">
<td>test</td>
<td>test</td>
</tr>
</tfoot>
</table>
</div>
jsfiddle
<style type="text/css">
#media only screen and (max-width: 480px) {
.secondary img {
width: 100%;
}
}
#import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200);
* {
margin: 0;
padding: 0;
-webkit-text-size-adjust: none;
}
body {
font-family:'Source Sans Pro', Arial, Helvetica, sans-serif;
}
h1 {
font-size: 50px;
font-weight: 200;
color: #FFFFFF;
line-height: 50px;
margin-bottom: 40px;
}
h2 {
font-size: 36px;
font-weight: 200;
color: #444444;
margin-bottom: 30px;
}
h2 strong {
font-weight: 400;
color: #51a33d;
}
h3 {
font-size: 24px;
font-weight: 400;
color: #444444;
}
p {
font-size: 18px;
font-weight: 400;
line-height: 24px;
color: #AEAEAE;
margin-bottom: 20px;
}
p.light {
font-size: 18px;
font-weight: 400;
line-height: 24px;
color: #999999;
margin-bottom: 30px;
}
p.quote {
font-size: 24px;
font-weight: 200;
line-height: 30px;
color: #444444;
}
table {
text-align: center;
}
table.wrap {
width: 640px;
margin: 0 auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
table.flat-bottom {
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-left-radius: 0px;
-webkit-border-bottom-right-radius: 0px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomleft: 0px;
-moz-border-radius-bottomright: 0px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
table.block {
width: 250px;
margin: 0 10px;
}
table.btn {
width:260px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
table.btn a {
width: 250px;
display: block;
font-weight: 400;
text-transform: uppercase;
text-decoration: none;
color: #FFFFFF;
}
table.single a {
font-size: 24px;
padding: 15px 0;
}
table.double a {
font-size: 18px;
padding: 10px 0;
}
table.green {
background: #51a33d;
}
table.gray {
background-color: #999999;
}
table.orange {
background-color: #F57B20;
}
table img {
margin: 0 auto;
}
a img {
border: none;
}
.main-img {
display: block;
width: 640px;
margin: 0 auto;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
}
.icon-img {
width: 90px;
height: 90px;
}
.main {
background-color: #444444;
}
.main a {
color: #FFFFFF;
text-decoration: none;
}
.secondary {
background-color: #EEEEEE;
}
.secondary a {
color: #51A33D;
text-decoration: none;
}
.secondary-logo img {
display: inline-block;
margin:0 auto 20px auto;
}
icon img {
display: inline-block;
margin:0 auto;
}
.unsubscribe {
font-size: 14px;
color: #999999;
text-align: center;
margin-bottom: 20px;
}
</style>
</head>
<body>
<center>
<div style="width:640px; text-align:center; margin: 0 auto;">
<p style="font-size: 14px; margin-bottom: 0px;">Trouble viewing? View it in your web browser.</p>
</div>
<table cellpadding="0" cellspacing="0" class="main wrap flat-bottom">
<tr>
<td width="50"> </td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" width="540" height="60"> </td>
</tr>
<tr>
<td colspan="3">
<img src="http://img03.en25.com/EloquaImages/clients/SnagajobcomInc/{33384eb5-e6b0-4030-a8f8-332c77753d99}_logo.png" alt="When I Work" />
</td>
</tr>
<tr>
<td colspan="3" height="30"> </td>
</tr>
<tr>
<td colspan="3">
<font face="'Source Sans Pro', Arial, Helvetica, sans-serif">
<h1>Building the Team to Make Scheduling Easier</h1>
<p>Last month we teamed up with When I Work to give our customers an extended free trial of their awesome scheduling software. There was such a great response that we wanted to make sure that you had another chance to easily schedule your employees.</p>
</font>
</td>
</tr>
<tr>
<td colspan="3" height="20"> </td>
</tr>
<tr>
<td colspan="3">
<table cellpadding="0" cellspacing="0">
<tr>
<td width="110"> </td>
<td>
<table class="" style="width: 320px;">
<tr>
<td valign="middle" height="55"><font face="'Source Sans Pro', Arial, Helvetica, sans-serif">Schedule My Employees</font></td>
</tr>
</table>
</td>
<td width="110"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" height="50"> </td>
</tr>
</table>
</td>
<td width="50"> </td>
</tr>
</table>
<img src="http://staging.thisclicks.net/email/wiw/v4/images/main-img-phone.jpg" class="main-img" />
<br />
<table cellpadding="0" cellspacing="0" class="secondary wrap">
<tr>
<td width="50"> </td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" height="70"> </td>
</tr>
<tr>
<td colspan="3">
<div class="secondary-logo">
<img src="http://staging.thisclicks.net/email/wiw/v4/images/wiw-logo.jpg" />
</div>
<font face="'Source Sans Pro', Arial, Helvetica, sans-serif">
<h2>Employee Scheduling. <strong>Reinvented.</strong></h2>
<p class="light">When I Work is the easiest way for a business to schedule and communicate with its employees using the web, mobile, text messaging, and social media.</p>
</font>
</td>
</tr>
<tr>
<td colspan="2" height="20"> </td>
</tr>
<tr>
<td width="110"> </td>
<td>
<table class="btn single green" style="width: 320px">
<tr>
<td valign="middle" height="65"><font face="'Source Sans Pro', Arial, Helvetica, sans-serif">Schedule My Employees</font></td>
</tr>
</table>
</td>
<td width="110"> </td>
</tr>
<tr>
<td colspan="3" height="80"> </td>
</tr>
</table>
</td>
<td width="50"> </td>
</tr>
</table>
<br />
<table cellpadding="0" cellspacing="0" class="secondary wrap">
<tr>
<td width="50"> </td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" width="540" height="70"> </td>
</tr>
<tr>
<td colspan="3">
<font face="'Source Sans Pro', Arial, Helvetica, sans-serif">
<h2>Make Life Easier for You<br />and Your Company</h2>
<p>When I Work is offering an extended free trial to<br />Snagajob customers for a limited time.</p>
<p class="light">Click below to begin receiving applications today!</p>
</font>
</td>
</tr>
<tr>
<td colspan="2" height="20"> </td>
</tr>
<tr>
<td width="110"> </td>
<td>
<table class="btn single green" style="width: 320px">
<tr>
<td valign="middle" height="65"><font face="'Source Sans Pro', Arial, Helvetica, sans-serif">Schedule My Employees</font></td>
</tr>
</table>
</td>
<td width="110"> </td>
</tr>
<tr>
<td colspan="2" height="60"> </td>
</tr>
</table>
</td>
<td width="50"> </td>
</tr>
</table>
<br />
<div class="unsubscribe"><font face="'Source Sans Pro', Arial, Helvetica, sans-serif">If you are no longer interested you can <unsubscribe>unsubscribe</unsubscribe> instantly.</font></div>
</center>
</body>
</html>
Its working in most of my email clients but looks awful in gmail. Do they not support something I'm doing? I know I had some trouble with gmail and margin in previous emails that we have done. Not really sure how I should reformat it from here?
Gmail strips out anything inside style tags, so you need to make sure all your styles are inline.
Here is a CSS Inliner tool tool from Zurb.
I have a Table with content and i cannot figure out how to align the content of the spans inside the table.
HERE IS THE FIDDLE
Here is have pasted 2 images. 1st image is actual result and second is desired result.I think that explains it all...
CODE:
<table width="100%" cellspacing="3" cellpadding="0" style="border: 1px solid black; border-collapse: collapse; font-family: arial; font-size: 12px;">
<thead>
<tr style="background-color: #d3d3d3;">
<td colspan="2" style="padding: 5px; font-weight: bold;">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 5px 0px 0px 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Order ID: <span style="font-weight: normal;text-align">#YCKY141</span>
</td>
<td style="padding-left: 20px; font-weight: bold;">Email: <span style="font-weight: normal;">wyz#ymca.com</span></td>
</tr>
<tr>
<td style="padding-left: 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Date: <span style="font-weight: normal;">28/03/2014</span>
</td>
<td style="padding-left: 20px; font-weight: bold;">Telephone: <span style="font-weight: normal;">XXX-XXX-XXXX</span>
</td>
</tr>
<tr>
<td style="padding-left: 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Payment Method: <span style="font-weight: normal;">On Invoice</span>
</td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Shipping Method: <span style="font-weight: normal;">Royal Mail</span>
</td>
<td style="padding-left: 20px;"></td>
</tr>
</tbody>
</table>
Little bit changes you have to apply to your table.
have a look at Demo
HTML
<table width="100%" cellspacing="3" cellpadding="0" style="border: 1px solid black; border-collapse: collapse; font-family: arial; font-size: 12px;">
<thead>
<tr style="background-color: #d3d3d3;">
<td colspan="2" style="padding: 5px; font-weight: bold;">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right-style: solid; border-right-color: #d3d3d3; border-width:1px">
<table>
<tr>
<td style="padding: 5px 0px 0px 5px; font-weight: bold; ; width: 60%;">Order ID:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal; text-align">#YCKY141</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">Date:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">28/03/2014</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">payment Method:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">OnInvoice</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">Shipping Method:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">Royal Mail</span></td>
</tr>
</table>
</td>
<td style="vertical-align:top">
<table>
<tr>
<td>Email :
</td>
<td>
<span style="font-weight: normal;">wyz#ymca.com</span>
</td>
</tr>
<tr>
<td>Telephone:
</td>
<td>
<span style="font-weight: normal;">XXX-XXX-XXXX</span>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
You just need to use a proper table layout:
<table>
<thead>
<tr>
<td colspan="4" class="headline">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td class="first">Order ID:</td>
<td class="second">#YCKY141</td>
<td class="third"></td>
<td class="fourth"></td>
</tr>
<tr>
<td class="first">Date:</td>
<td class="second">2014-03-28</td>
<td class="third">Email</td>
<td class="fourth">wyz#ymca.com</td>
</tr>
</tbody>
</table>
CSS:
body {
font-family: Arial;
font-size: 12px;
}
table {
border: 1px solid #000;
border-collapse: collapse;
}
.headline {
background-color: #d3d3d3;
font-weight: bold;
padding: 5px;
}
.first,
.third {
font-weight: bold;
padding: 0 5px;
width: 20%;
}
.second,
.fourth {
width: 30%;
}
.third {
border-left: 1px solid #d3d3d3;
}
Demo: http://jsfiddle.net/kZ7Hj/
Wrap each key (Order Id, Date, etc.) in a span with display:inline-block and a width.
Example:
<span style="display:inline-block;width:40%;">Order Id</span>
Edit: Be sure to remove the inline styles when you're done experimenting. It'll make maintenance and debugging a lot easier. Just saw your comment about this being for an email template. I haven't looked at css support in email clients in some time and display:inline-block might not be supported.
I'm not sure if that is what you want but I applied :
<div style="width:200px; display:inline-block;">..</div>
on labels and it seems to be aligned just fine.
Here you can find an example: http://jsfiddle.net/LxD9N/12/
Replace the <span> element with an extra <td> element and align it.
I have three tables table1,table2,table3 all wrapped inside a table, while adding different size of contents to the tables each expands to different height , how to make all the three tables display at same height even after adding different size of content
HTML :
<div class="csdiv">
<table cellpadding="2" cellspacing="0">
<tr valign="top">
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th width="33%" nowrap>Table1</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">
</td>
</tr>
</table>
</td>
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th nowrap width="34%" nowrap>Table2</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">
</td>
</tr>
</table>
</td>
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th nowrap width="33%" nowrap>Table3</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
CSS:
.csdiv {
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
line-height: 1em;
}
.cstable {
border-collapse: collapse;
border-color: #666666;
border-style: solid;
border-width: 1px;
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
line-height: 1em;
}
.cstable th {
background-color: #A3C2FF;
border-collapse: collapse;
border-color: #666666;
border-style: solid;
border-width: 1px;
color: #000000;
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
font-weight: bold;
line-height: 1em;
text-align: left;
}
JSFIDDLE : DEMO
Your parent elements has no height set, so the table is taking height only equal to the content.To make it full height, add
html,body{
height:100%; /*give full height to document */
width:100%;
margin:0;
padding:0;
}
table{
height:100%; /* stretch table to parents height*/
}
demo
I have table cells with class=image to which I cannot seem to apply any CSS. Here is my markup (nested tables) where the first table shows an example of a typical row:
<table class="outer">
<tr>
<td>
<table class="column" id="leftColumn">
<tr>
<td>
<table class="cell" id="t1">
<tr>
<td><asp:Literal runat="server" ID="t1r2c1" /></td>
<td class="image">
<span id="s1" runat="server">
<asp:PlaceHolder ID="p1" runat="server">
</asp:PlaceHolder>
</span>
</td>
<td><asp:Literal runat="server" ID="t1r2c3" /></td>
<td class="gray"><asp:Literal runat="server" ID="t1r2c4" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t2">
</table>
</td>
</tr>
</table>
</td>
<td>
<table class="column" id="rightColumn">
<tr>
<td>
<table class="cell" id="t3">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t4">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t5">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t6">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t7">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t8">
</table>
</td>
</tr>
<tr>
<td>
<table class="messages" id="t9">
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Here is my CSS:
.outer
{
border: none;
margin-left: auto;
margin-right: auto;
}
.outer td
{
vertical-align: top;
}
.column
{
border: none;
}
#rightColumn table, #leftColumn table
{
width: 100%;
}
.cell
{
border-collapse: collapse;
border: 2px solid black;
margin: 5px;
}
.cell td
{
border-collapse: collapse;
border: 2px solid black;
text-align: center;
vertical-align: middle;
padding-left: 3px;
padding-right: 3px;
padding-top: 0px;
padding-bottom: 0px;
font-size: 11pt;
}
.cell .image
{
padding: 0;
margin: 0;
height: 2px;
width: 7px;
}
.messages td
{
border-collapse: collapse;
border: 2px solid #FF0000;
text-align: left;
}
h1
{
text-align: center;
font-size: 150%;
}
h2
{
text-align: center;
}
th
{
height: 24px;
background-color: #2B60DE;
color: #FFFFFF;
}
.gray
{
background-color: #AAAAAA;
}
Nothing I do to .cell .image seems to be able to shrink the images below a certain size -- which is already much smaller than the actual images so I know some shrinking is already going on.
Any advice is appreciated.
Could be the line-height or font-size preventing the td to become smaller.
Try setting the tds of the row with the image to line-height: 0px and font-size: 0px
I put together a jsfiddle of your example at http://jsfiddle.net/9xLqY/. The styles are being applied just fine when I remove the ASP components:
<span id="s1" runat="server">
<asp:PlaceHolder ID="p1" runat="server"></asp:PlaceHolder>
</span>
So it must be one of these components that is forcing the cells to be larger than you want. You'll need to add styles for #s1 and #p1.