Gap between the lines in a table - ASP.Net

Posted on 2010-08-25
Medium Priority
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
  • 4
  • 2

Accepted Solution

hehdaddy earned 2000 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)
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
      <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="http://www.google.com">
                              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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

621 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