Gap between the lines in a table - ASP.Net

Posted on 2010-08-25
Last Modified: 2012-06-27
I have a column in a table, the gap between the first and second lines should be very less.
Find attached the grid and code.

Could someone help me.

Question by:cimscims
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

hehdaddy earned 500 total points
ID: 33523979
If you are using a stylesheet try different line-height values on the hyperlink tag. That should allow you to push the lines closer together. An example would be:

    line-height: 10px;


You may have to play with the numbers to get it right.

Author Comment

ID: 33524743
line-height did not work. Is there any way? I tried giving cellpadding and cellspacing, both provide the spave between two records..but it will not solve my problem.

Expert Comment

ID: 33525757
try border="0" cellpadding="0" cellspacing="0" for the table(not for tr)
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.


Author Comment

ID: 33527028
This will not work. The wrapped lines and rows will look similar. I just need to reduce the gap between the wrapped lines(in a single TD) and keep some space between the rows using cellspacing and cellpadding.

Expert Comment

ID: 33527466
Here is some sample markup that comes from an ASP.NET page I made with a fixed width table and an ASP.NET HyperLink control.

I applied a line-height to the "a" tag and it worked. You can squish/expand it as much as you want.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
      <style type="text/css">
                  line-height: 13px;
    <form method="post" action="lt01.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTQxNDA4MzY4MmRkVxiWO84XT7udX5VqjBTRJK12GvcvQL5GbNNBAWuyIJ8=" />
            <table cellspacing="0" cellpadding="0" border="1" width="200">
                        <td style="width: 100px;">Test
                        <td style="width: 100px;">
                              <a id="hl1" href="">
                              This is a lot of text that should wrap over at least two lines of text.


Author Comment

ID: 33530460
sorry hehdaddy. I didn't see your post unitl i signed into EE..i couldn't try your solution as i got it worked with the below code. But it is your idea of using line-height. Thank you.

What i have done is

<td width="42%">
         <td style="line-height:14px">
              <asp:hyperlink ........... ></asp:hyperlink>


Author Closing Comment

ID: 33530461
Worked. Thanks.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question