Remove unwanted spacing ( ) between 2 table elements - html

I need to create a page layout with <table> elements. The problem I have that it's being auto generated in the DOM extra unwanted spacing, in the form of &nbsp. How can I remove it?
See Images:
Results:
The Challenge:
The challenge I have. I can only use inline styles & no javascript & I cannot use flex instead of tables. Since it's going to be used in emails. and not all email clients support flex yet.
<div style="width:375px;margin:0 auto;font-family: Helvetica,sans-serif;">
<table style="width:100%;background-color: aliceblue;border-bottom: 1px #539ecb solid;
border-top: 1px #539ecb solid;color: #334859; text-transform: uppercase;padding:0 15px;">
<!-- Entries Header -->
<tr>
<td style="padding:3px 0;width: 47%;">
<h5 style="margin:0;">Description</h5>
</td>
<td style="text-align: center;width: 25%;">
<h5 style="margin:0;">Qty</h5>
</td>
<td style="text-align: right;">
<h5 style="margin:0;">Amount</h5>
</td>
</tr>
</table>
<table style="width: 100%;padding:0 15px;">
<!-- Entries -->
<tr>
<td style="padding:5px 0;width: 50%;">
<span style="text-transform: uppercase;font-size: 13px;">Office desk</span>
</td>
<td style="padding:5px 0;text-align: center;width: 25%;">
<small style="margin: 0;font-size: 11px;">2 x $217.75</small>
</td>
<td style="padding:5px 0;text-align:right;">
<span style="margin: 0;font-size: 13px;">$435.50</span>
</td>
</tr>
</table>
</div>

It seems like the issue is the s you intentionally added within the table. HTML has strict rules about what can and can't be a direct child of the various table elements.
A text node can't be the direct child of a tr, which can contain only:
Zero or more td, th, and script-supporting elements.
Therefore, the text nodes get pushed outside the table. Remove those, and the visual layout will be fixed (I'd still recommend fixing the semantics of the markup, though).
Original answer below
Your HTML is malformed in any case. What looks to be a table header row and body row are represented as 2 separate tables. Try something like this:
<table style="border-collapse: collapse;">
<thead style="/* styles from what's currently your first table */">
<tr>
<!-- content from what's currently your first table -->
<th>...</th>
<th>...</th>
<th>...</th>
</tr>
</thead>
<tbody style="/* styles from what's currently your second table */">
<tr>
<!-- content from what's currently your second table -->
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>

You can replace the s with empty string.
document.querySelector("#our_div").innerHTML = document.querySelector("#our_div").innerHTML.replace(/ /g, '');
<div id="our_div" style="width:375px;margin:0 auto;font-family: Helvetica,sans-serif;display:block;">
<table style="width:100%;background-color: aliceblue;border-bottom: 1px #539ecb solid;
border-top: 1px #539ecb solid;color: #334859; text-transform: uppercase;padding:0 15px;">
<!-- Entries Header -->
<tr>
<td style="padding:3px 0;width: 47%;">
<h5 style="margin:0;">Description</h5>
</td>
<td style="text-align: center;width: 25%;">
<h5 style="margin:0;">Qty</h5>
</td>
<td style="text-align: right;">
<h5 style="margin:0;">Amount</h5>
</td>
</tr>
</table>
<table style="width: 100%;padding:0 15px;">
<!-- Entries -->
<tr>
<td style="padding:5px 0;width: 50%;">
<span class="item-name" style="text-transform: uppercase;font-size: 13px;">Office desk</span>
</td>
<td style="padding:5px 0;text-align: center;width: 25%;">
<small class="qty" style="margin: 0;font-size: 11px;">2 x $217.75</small>
</td>
<td style="padding:5px 0;text-align:right;">
<span class="item-price" style="margin: 0;font-size: 13px;">$435.50</span>
</td>
</tr>
</table>
</div>
Here is pure CSS solution. Adjust font-size:0 to div and font-size:1rem to tables. CSS can't remove it, but can hide.
#our_div {
font-size:0;
}
#our_div table {
font-size:1rem;
}
<div id="our_div" style="width:375px;margin:0 auto;font-family: Helvetica,sans-serif;font-size:0;">
<table style="width:100%;background-color: aliceblue;border-bottom: 1px #539ecb solid;
border-top: 1px #539ecb solid;color: #334859; text-transform: uppercase;padding:0 15px;">
<!-- Entries Header -->
<tr>
<td style="padding:3px 0;width: 47%;">
<h5 style="margin:0;">Description</h5>
</td>
<td style="text-align: center;width: 25%;">
<h5 style="margin:0;">Qty</h5>
</td>
<td style="text-align: right;">
<h5 style="margin:0;">Amount</h5>
</td>
</tr>
</table>
<table style="width: 100%;padding:0 15px;">
<!-- Entries -->
<tr>
<td style="padding:5px 0;width: 50%;">
<span class="item-name" style="text-transform: uppercase;font-size: 13px;">Office desk</span>
</td>
<td style="padding:5px 0;text-align: center;width: 25%;">
<small class="qty" style="margin: 0;font-size: 11px;">2 x $217.75</small>
</td>
<td style="padding:5px 0;text-align:right;">
<span class="item-price" style="margin: 0;font-size: 13px;">$435.50</span>
</td>
</tr>
</table>
</div>

It would be far better to do that with JS. In CSS you can try to set some font styles for the div container to hide the " " characters and set the styles to their initial values for the tables (so they do not inherit values from the container).
div{
font-size:0;
line-height:0;
color: transparent;
user-select: none;
}
div>table{
font-size: 16px; //or any other
line-height: normal; //or any other
color: black; //or any other
user-select: auto;
}

Related

HTML email design - Alternatives to putting an <a> tag around a <table>

This question is very similar to How to link block level elements in html e-mails?, but that question is quite old and the solutions provided didn't fit my use-case. I'm working on an email template that shows a row of items each kept within a table with multiple rows. Each of the gray boxes is its own table.
<table cellpadding="4" cellspacing="4" style="table-layout:fixed; width:800px; margin: 0 auto;">
<tr>
<td style="background-color: #f3f3f3; border-color: #cfcfcf; vertical-align: top; border-style: solid; border-width: 1px">
<table cellpadding="0" style="table-layout:fixed; width:100%">
<tr>
<td style="color: #525252; vertical-align: top; height: 35px;"> Item 1 </td>
</tr>
<tr>
<td style="color: #525252; height: 150px"><img src="https://www.isdntek.com/gif/polaroid140.gif" style="height: 10px;" /></td>
</tr>
<tr>
<td> $9.99 </td>
</tr>
<tr>
<td> 20 bids </td>
</tr>
<tr>
<td> 20 watchers </td>
</tr>
</table>
</td>
<td style="background-color: #f3f3f3; border-color: #cfcfcf; vertical-align: top; border-style: solid; border-width: 1px">
<table cellpadding="0" style="table-layout:fixed; width:100%">
<tr>
<td style="color: #525252; vertical-align: top; height: 35px;"> Item 2 </td>
</tr>
<tr>
<td style="color: #525252; height: 150px"><img src="https://www.isdntek.com/gif/polaroid140.gif" style="height: 50px;" /></td>
</tr>
<tr>
<td> $9.99 </td>
</tr>
<tr>
<td> 20 bids </td>
</tr>
<tr>
<td> 20 watchers </td>
</tr>
</table>
</td>
<td style="background-color: #f3f3f3; border-color: #cfcfcf; vertical-align: top; border-style: solid; border-width: 1px">
<table cellpadding="0" style="table-layout:fixed; width:100%">
<tr>
<td style="color: #525252; vertical-align: top; height: 35px;"> Item 3 </td>
</tr>
<tr>
<td style="color: #525252; height: 150px"><img src="https://www.isdntek.com/gif/polaroid140.gif" style="height: 100px;" /></td>
</tr>
<tr>
<td> $9.99 </td>
</tr>
<tr>
<td> 20 bids </td>
</tr>
<tr>
<td> 20 watchers </td>
</tr>
</table>
</td>
<td style="background-color: #f3f3f3; border-color: #cfcfcf; vertical-align: top; border-style: solid; border-width: 1px">
<table cellpadding="0" style="table-layout:fixed; width:100%">
<tr>
<td style="color: #525252; vertical-align: top; height: 35px;"> Item 4 </td>
</tr>
<tr>
<td style="color: #525252; height: 150px"><img src="https://www.isdntek.com/gif/polaroid140.gif" style="height: 140px;" /></td>
</tr>
<tr>
<td> $9.99 </td>
</tr>
<tr>
<td> 20 bids </td>
</tr>
<tr>
<td> 20 watchers </td>
</tr>
</table>
</td>
</tr>
</table>
sample
Right now I have two anchor tags that link to the same place - one over the item title and one over the item image. I'm trying to reduce the number of links inside the email, so ideally I'd be able to place an anchor tag over the entire table and have the whole gray box be clickable.
Unfortunately, as mentioned in the SO post linked above, putting an anchor tag around a block element is not supported in email clients like Outlook. If you do that, nothing is clickable.
Here is a JS Fiddle with code snippets for:
Our original design with 2 links for each item.
The ideal design has an anchor tag around the whole table, but it is unusable due to Outlook.
A failed attempt to use span elements with br elements to maintain the look of the original.
If I can recreate the original design with inline elements I'd be willing to try that, but each item has a dynamic title and image, so I think I have to use fixed heights to make everything line up correctly.
If anyone has any advice or techniques, I'd really appreciate it. Thank you!
How about adding an onclick to the table like this
<table onclick="location.href='your location'">
<table onclick="window.location.href='your location'">
I think this will work.

How do I remove space between table rows when sending as an email? [duplicate]

This question already has answers here:
Image inside div has extra space below the image
(10 answers)
Closed 3 years ago.
I have an HTML markup which is send as an email to the user that subscribe to the site. User enters their email id and on click of a button design is sent to the user as an email.
HTML markup for the view file is:
<table style="margin: auto;
background: lightgray;width: 500px;border-spacing: unset;">
<tbody>
<tr>
<td>
<img src="https://cetra.in/Images/logo.png" /></td>
<td align="center" colspan="2"> <h1 style="margin: auto;">Cetra Business Travel<h1></td>
</tr>
<tr>
<td colspan="3" align="center"><img src="https://cetra.in/Images/subscribe.png" style="height: 300px;width: 500px;" /> </td>
</tr>
<tr style="background: #ffcf3d;" ><td colspan="3" style="width: 10px;padding-top: 45px;padding-bottom: 45px;">
<p style="text-align: center;
font-size: 25px;padding: 0px 50px;">
Thank you for subscribing. We are delighted to have you.Thank you for subscribing. We are delighted to
have you Thank you for subscribing. We are delighted to have you
</p>
</td></tr>
<tr style="background: white;">
<td colspan="3" align="center" style="padding-bottom: 45px;padding-top: 45px"><button type="button" style="color: white;
height: 53px;
background: black;
font-size: 30px;
padding: 10px;
border-radius: 60px;
border: none;
">Read More</button></td>
</tr>
<tr style="background: white;">
<td align="center">
<span>
<a style="color:white" href="https://www.facebook.com/pg/cetrabusinesstravel/about/">
<img src="https://cetra.in/Images/facebook_logo2.png" style="height:50px;width:50px"/></a></span>
</td>
<td align="center"><span>
<a style="color:white" href="https://twitter.com/cetrabiztravel?lang=en">
<img src="https://cetra.in/Images/twitter_logo.png" style="height:50px;width:50px"/></a></span></td>
<td align="center"><span>
<a style="color:white" href="https://in.linkedin.com/company/cetrabusinesstravel">
<img src="https://cetra.in/Images/linkedIn_logo.png" style="height:50px;width:50px"/>
</a></span></td>
</tr>
<tr style="background: white;">
<td colspan="3" align="center">
<p>Cetra Business Travel</p>
</td>
</tr>
<tr style="background: white;">
<td colspan="3" align="center"><p>
E 1202 Titanium City Center , Anand nagar road
prahladnagar
Ahmedabad, Gujarat 380015, IN
</p></td>
</tr>
<tr style="background: white;">
<td align="center" colspan="3"> Cetra Hospitality
<a href='cetra.in/user_unsubscribe/<?php echo $id ?> '> Unsubscribe</a></td>
</tr>
</tbody>
</table>
The variable message in the controler contains HTML markup from this view.
It works just fine when it is viewed in the localhost but when that same file is sent as a message it shows some gap between the image and the text which are in two different .
How do I remove this gap between the image and text?
Look like image leaving some space add display:block to image.

How to prevent overflow of div content

I have a html that when the window shrinks, the content of sub divs gets cutoff. Even though the outermost div is overflow:auto, and there is a scroll bar..
I notice that overflow:hidden is set in multiple child divs. The thing is the inner html are generated from some API and it would impractical to reset all these overflow properties.
My question is:
the height/width of these child divs are not set, why the overflow property still applies?
is there another way to prevent cutoff in child div? Like making sure the parent div has enough height?
Below is a simplified version of my html:
<div id="main" style="width: 100%; height: 100%; overflow: auto; -ms-zoom: 1;" abp="1">
<div style="box-sizing:border-box">
<div style="overflow:hidden;text-align:left">
<div id="SecListA" style="width: 100%; height: 100%; overflow: hidden; position: relative;">
<div>
<span class="ttl" id="sectKey-18-HL" style="font-size: 20px; font-weight: 600;" abp="373">Section A</span>
</div>
</div>
</div>
</div>
<div style="box-sizing:border-box">
<div style="overflow:hidden;text-align:left">
<div id="SecListB" style="width: 100%; height: 100%; overflow: hidden; position: relative;">
<div>
<span class="ttl" id="sectKey-18-HL" style="font-size: 20px; font-weight: 600;" abp="373">Section B</span>
</div>
<table class="skTbl" id="MRLTable-CVIntList280">
<thead abp="416">
<tr class="visHid colHdr" abp="417">
<th class="rIndent" abp="418"></th>
<th class="hlImp" style="width: 96%;" abp="419"></th>
<th style="width: 1%;"></th>
<th style="width: 1%;"></th>
<th style="width: 1%;"></th>
<th style="width: 1%;"></th>
</tr>
</thead>
<tbody abp="424">
<tr style="display: none;" abp="425">
<td abp="426"></td>
</tr>
<tr>
<td abp="428"></td>
<td abp="429">
<div style="padding-left: 0px; display: inline-block;" abp="430"><span class="vbIcn icn icnMan" abp="431"><img src="C:\PROGRAM FILES (X86)\Y.png" abp="432"></span></div> subtitle A
</td>
<td abp="433">
<span abp="434"></span>
</td>
<td abp="435"><span abp="436"></span></td>
<td abp="437"><span class="MRLRecFldHover" abp="438"></span></td>
<td abp="439"><span class="MRLRecFldHover" abp="440"></span></td>
</tr>
<tr title="Edit this item">
<td abp="442"></td>
<td class="hlImp titleField hlImp" abp="443"><span tabindex="0"><div style="padding-left: 20px; display: inline-block;" abp="445"><span class="vbIcn icn icnMan"><img src="C:\PROGRAM FILES (X86)\X.png"></span></div> paragrah A</span>
</td>
<td abp="448"><span></span></td>
<td abp="450"><span></span></td>
<td abp="452"><span></span></td>
<td abp="454"><span><span class="itAct" abp="456"><span title="Remove this set" style="padding: 0px 24px 16px 8px; vertical-align: top;"><span class="vbIcn icn icnDelete" abp="458"></span></span>
</span>
</span>
</td>
</tr>
<tr>
<td></td>
<td colspan="5">
<table class="skForceFitTbl skTbl" cellspacing="0" cellpadding="0" abp="462">
<tbody abp="463">
<tr class="noLn" abp="464">
<td class="skForceFitCell" abp="465">
<span abp="466">
<table style="width: 100%; border-collapse: collapse; -ms-overflow-y: hidden;">
<tbody abp="468">
<tr abp="469">
<td style="padding-left: 40px;" abp="470"></td>
<td style="width: 100%; text-align: left;" abp="471">
<span style="font-family: 'Segoe UI'; font-size: 14px; font-weight: normal;">
some text for the ssdfasdfdsfffffffffffffffffffffffffffffffffffffffffffffffffffff. <br>dddddd
</span>
</td>
</tr>
</tbody>
</table>
</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="display: none;" abp="425">
<td abp="426"></td>
</tr>
<tr>
<td abp="428"></td>
<td abp="429">
<div style="padding-left: 0px; display: inline-block;" abp="430"><span class="vbIcn icn icnMan" abp="431"><img src="C:\PROGRAM FILES (X86)\Y.png" abp="432"></span></div> subtitle B
</td>
<td abp="433">
<span abp="434"></span>
</td>
<td abp="435"><span abp="436"></span></td>
<td abp="437"><span class="MRLRecFldHover" abp="438"></span></td>
<td abp="439"><span class="MRLRecFldHover" abp="440"></span></td>
</tr>
<tr title="Edit this item">
<td abp="442"></td>
<td class="hlImp titleField hlImp" abp="443"><span tabindex="0"><div style="padding-left: 20px; display: inline-block;" abp="445"><span class="vbIcn icn icnMan"><img src="C:\PROGRAM FILES (X86)\X.png"></span></div> paragrah A</span>
</td>
<td abp="448"><span></span></td>
<td abp="450"><span></span></td>
<td abp="452"><span></span></td>
<td abp="454"><span><span class="itAct" abp="456"><span title="Remove this set" style="padding: 0px 24px 16px 8px; vertical-align: top;"><span class="vbIcn icn icnDelete" abp="458"></span></span>
</span>
</span>
</td>
</tr>
<tr>
<td></td>
<td colspan="5">
<table class="skForceFitTbl skTbl" cellspacing="0" cellpadding="0" abp="462">
<tbody abp="463">
<tr class="noLn" abp="464">
<td class="skForceFitCell" abp="465">
<span abp="466">
<table style="width: 100%; border-collapse: collapse; -ms-overflow-y: hidden;">
<tbody abp="468">
<tr abp="469">
<td style="padding-left: 40px;" abp="470"></td>
<td style="width: 100%; text-align: left;" abp="471">
<span style="font-family: 'Segoe UI'; font-size: 14px; font-weight: normal;">
some text for the testing. This text will get cutoff when the window is small enough.... <br>dddddd
</span>
</td>
</tr>
</tbody>
</table>
</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr title="Edit this item">
<td abp="442"></td>
<td class="hlImp titleField hlImp" abp="443"><span tabindex="0"><div style="padding-left: 20px; display: inline-block;" abp="445"><span class="vbIcn icn icnMan"><img src="C:\PROGRAM FILES (X86)\X.png"></span></div> paragrah B</span>
</td>
<td abp="448"><span></span></td>
<td abp="450"><span></span></td>
<td abp="452"><span></span></td>
<td abp="454"><span><span class="itAct" abp="456"><span title="Remove this set" style="padding: 0px 24px 16px 8px; vertical-align: top;"><span></span></span>
</span>
</span>
</td>
</tr>
<tr>
<td></td>
<td colspan="5">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<span>
<table style="width: 100%; border-collapse: collapse; -ms-overflow-y: hidden;">
<tbody abp="468">
<tr abp="469">
<td style="padding-left: 40px;" abp="470"></td>
<td style="width: 100%; text-align: left;" abp="471">
<span style="font-family: 'Segoe UI'; font-size: 14px; font-weight: normal;">
some text for the testing. This text will get cutoff when the window is small enough.... <br>dddddd
</span>
</td>
</tr>
</tbody>
</table>
</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
Thats just how overflow works. If you set it to hidden on a div, any content that flows outside of its boundaries, regardless of what makes it flow outside, it gets clipped.
Ideally the proper solution would be to change the markup. However, if you really can't, you can hack it with css using !important:
#main div {
overflow: initial !important;
}
#main {
width: initial !important;
overflow: initial !important;
}
div#SecListB {
overflow: initial !important;
}
Check out a fiddle here.
This text...
some text for the ssdfasdfdsfffffffffffffffffffffffffffffffffffffffffffffffffffff.
is most likely the cause (it appears several times). It contains one extremely long "word" which forces the table-cell which is in to be extended. But that's completely unrealistic. Use real text with real word lenghts, this will change the whole scenario.
(If you don't want to type text, just google "blindtext generator" - there are pages that generate random text for you which you can copy.)

Responsive Email (Outlook 2016) issues

I used this responsive email template to design a tabular report email template but unfortunately it renders horribly on outlook desktop 2016.
I'll appreciate any form of help I can get to make my template look better on outlook desktop.
Here is the code snippet for the tabular area of the template:
<tr>
<td align="center" valign="top">
<!-- CENTERING TABLE // -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<!-- FLEXIBLE CONTAINER // -->
<table border="0" cellpadding="5" cellspacing="0" width="600" class="flexibleContainer">
<tr>
<td align="center" valign="top" width="600" class="flexibleContainerCell" style="background-color:#dd4f05;">
<!-- CONTENT TABLE // -->
<table border="0" cellpadding="10" cellspacing="0" width="100%" style='table-layout:fixed'>
<thead style="color: #ffffff; line-height: 200%; font-family:Tahoma,Verdana,Segoe,sans-serif; font-size: 15px; margin-top: 3px; margin-bottom: 3px; text-align: right; font-weight: bold">
<col width=6 />
<col width=10 />
<col width=6 />
<tr>
<th align="left">Category</th>
<th>Novemeber Spend</th>
<th align="left">Vs October </th>
</tr>
</thead>
<tbody style="color: #ffffff; line-height: 200%; font-family: Tahoma,Verdana,Segoe,sans-serif; font-weight: normal; margin-top: 3px; margin-bottom: 3px; text-align: left;">
<tr>
<td style="font-size: 20px;" align="left">Food</td>
<td align="right" style="font-size: 30px;">₦1,234,567.00</td>
<td align="right">
<div style="font-size: 25px;color: #008000; float: left">▲</div>
<p style="float: left; margin: 0; font-size: 20px">23%</p>
</td>
</tr>
<tr>
<td style="font-size: 20px;" align="left">Gadgets</td>
<td align="right" style="font-size: 30px;">₦901,234.00</td>
<td align="right">
<div style="font-size: 25px;color: #008000; float: left">▲</div>
<p style="float: left; margin: 0; font-size: 20px">74%</p>
</td>
</tr>
<tr>
<td style="font-size: 20px;" align="left">Entertainment</td>
<td align="right" style="font-size: 30px;">₦789,012.00</td>
<td align="right">
<div style="font-size: 25px;color: #008000; float: left">▲</div>
<p style="float: left; margin: 0; font-size: 20px">23%</p>
</td>
</tr>
<tr>
<td style="font-size: 20px;" align="left">School Fees</td>
<td align="right" style="font-size: 30px;">₦567,890.00</td>
<td align="right">
<div style="font-size: 25px;color: #008000; float: left">▲</div>
<p style="float: left; margin: 0; font-size: 20px">10%</p>
</td>
</tr>
<tr>
<td style="font-size: 20px;" align="left">Health Care</td>
<td align="right" style="font-size: 30px;">₦ 345,678.00</td>
<td align="right">
<div style="font-size: 25px;color: #008000; float: left">▲</div>
<p style="float: left; margin: 0; font-size: 20px">6%</p>
</td>
</tr>
</tbody>
</table>
<!-- // CONTENT TABLE -->
</td>
</tr>
</table>
<!-- // FLEXIBLE CONTAINER -->
</td>
</tr>
</table>
<!-- // CENTERING TABLE -->
</td>
</tr>
How it looks on web version of gmail and yahoo:
How it looks on outlook desktop client (Horrible):
I strongly suggest using display: inline-block as floats do not work at all with Outlook. This is a great reference as to what does and does not work with emails.
I would suggest changing the in that last column to a span, remove the float: left from both it and the paragraph - in fact, remove the paragraph tag entirely, and add font-size to the tag, which should be left aligned, not right. You're giving too many contradictory instructions for poor little Outlook to follow.

How to add horizontal line in a table?

Following is the code of table :
<table cellpadding="0" cellspacing="" width="100%" border="0">
<tbody>
<tr class="pack_list_divider">
<td width="30%" rowspan="2">
<img id="coursimg" src="test_listings_files/default_package_image.png" alt="Section wise test" border="0">
</td>
<td width="25%">
<p class="pckgvalidity">
Validity : 1 Year
</p>
</td>
<td width="35%">
<p class="pckgvalidity">Number of Tests : 0
</p>
</td>
<td width="20%" valign="middle">
<!--<p id="test_list_loader" height="20" align="center" style="display:none;"></p> -->
Test Details
</td>
</tr>
<tr>
<td colspan="2" width="50%" valign="top">
<p class="descp">
sectionm wise tests
</p>
</td>
<td width="20%">
<p class="pckgrs"> <span class="rs fl" style="color:#333333; font:25px bold; margin:0px 0px 10px 10px;"> Free </span>
<span>
<a class="user-not-loggedin more addcart fl" href="http://localhost/entrance_prime/Entrance_Prime/entprm/web/my_cart.php?pack_id=21e86b3ebf6a8af2a9fcf136c4f8e88a&pack_type=test&op=aa" id="21e86b3ebf6a8af2a9fcf136c4f8e88a" value="21e86b3ebf6a8af2a9fcf136c4f8e88a" style="background:url(../images_new/add_account.png) 0 0 no-repeat;"> </a>
</span>
</p>
</td>
</tr>
</tbody>
</table>
I want a horizontal line in between the rows. I've tried so many tricks but none of them did the magic for me. How can this issue be resolved?
I use this trick:
<table>
<tr style="border-bottom:1px solid black">
<td colspan="100%"></td>
</tr>
<tr> ... </tr>
</table>
Use a Table Header and add the underline in there
table { border-collapse:collapse; }
table thead th { border-bottom: 1px solid #000; }
<table>
<thead>
<tr>
<th>Valididty></th>
<th>No Of Tests</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test</td>
<td>Test</td>
</tr>
</tbody>
</table>
With CSS you can style the header row. Make each cell have a bottom border.
have a look here: http://jsfiddle.net/ZmBmh/
HTML
<table>
<tr class="firstLine">
<td>hey</td><td>hello</td><td>yuhuu</td>
</tr>
<tr>
<td>hey</td><td>hello</td><td>yuhuu</td>
</tr>
<tr>
<td colspan="3"><hr/></td>
</tr>
<tr>
<td>hey</td><td>hello</td><td>yuhuu</td>
</tr>
</table>
CSS
table{
border-collapse: collapse;
}
.firstLine td{
border-bottom: 2px solid black;
}
Something like this:
<table border="1" cellpadding="0" cellspacing="" width="100%">
<tbody>
<tr class="pack_list_divider">
<tr> </tr>
<td width="25%">
<p class="pckgvalidity">
Validity : 1 Year
</p>
</td>
<td width="35%">
<p class="pckgvalidity">Number of Tests : 0
</p>
</td>
<td width="20%" valign="middle">
<!--<p id="test_list_loader" height="20" align="center" style="display:none;"></p> -->
Test Details
</td>
</tr>
<tr>
<td colspan="2" width="50%" valign="top">
<p class="descp">
sectionm wise tests
</p>
</td>
<td width="20%">
<p class="pckgrs"> <span class="rs fl" style="color:#333333; font:25px bold; margin:0px 0px 10px 10px;"> Free </span>
<span>
<a class="user-not-loggedin more addcart fl" href="http://localhost/entrance_prime/Entrance_Prime/entprm/web/my_cart.php?pack_id=21e86b3ebf6a8af2a9fcf136c4f8e88a&pack_type=test&op=aa" id="21e86b3ebf6a8af2a9fcf136c4f8e88a" value="21e86b3ebf6a8af2a9fcf136c4f8e88a" style="background:url(../images_new/add_account.png) 0 0 no-repeat;"> </a>
</span>
</p>
</td>
</tr>
</tbody>
</table>
Tell me if that is what you're looking for.