Solved

<table>

Posted on 2012-03-10
5
173 Views
Last Modified: 2012-03-11
Hi I have the following structure for my <table> tag
6 rows

row1 has 2 columns
row 2 has 2 columns
row 3 has 6 columns
row 4 has 6 columns
row 5 has 5 columns
row 6 has 5 columns

The problem i am having is, the columns are of different width. I want the columns to be aligned in each row. This is not happening.

I used colspan=5 Does not help for row 2 column 2.

Is there a better way to align columns with different widths?
0
Comment
Question by:genius_geek
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:pdd1lan
ID: 37704736
<table>
    <tr>
          <td colspan="3"></td>
         <td colspan="3"></td>
   </tr>
<tr>
          <td colspan="3"></td>
         <td colspan="3"></td>
   </tr>
<tr>
          <td colspan="1"></td>
         <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
   </tr>
<tr>
          <td colspan="1"></td>
         <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
   </tr>
<tr>
          <td colspan="2"></td>
         <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
         <td colspan="1"></td>
   </tr>

<tr>
          <td colspan="2"></td>
         <td colspan="1"></td>
         <td colspan="1"></td>
          <td colspan="1"></td>
         <td colspan="1"></td>
   </tr>
</table>
0
 

Author Comment

by:genius_geek
ID: 37704752
i tried that. I will tell you why it does not work.

row 2 has two input type=text (column1 and column2) each textbox with size is 25
row 4 has 6 textboxes, 1st with size 25, 2nd 3rd 4th with size 2, 5th and 6th with size 7

in the above mentioned case, r2c2 and r2c3 will be faaaaaar apart. how would you solve that?
0
 

Author Comment

by:genius_geek
ID: 37704758
also 1st and 2nd row is spilt as 1,5 and not 3,3
0
 
LVL 8

Accepted Solution

by:
pdd1lan earned 500 total points
ID: 37704774
I put row 2 and row 6 as you mentioned, and looks align up to me.  I misunderstand your question.
 
  <tr>
          <td colspan="1"><input type="textbox" name="t1" size="25"></td>
         <td colspan="5"><input type="textbox" name="t2" size="25"></td>
   </tr>
<tr>
          <td colspan="1"><input type="textbox" name="t2" size="25"></td>
         <td colspan="1"><input type="textbox" name="t2" size="2"></td>
         <td colspan="1"><input type="textbox" name="t2" size="2"></td>
          <td colspan="1"><input type="textbox" name="t2" size="2"></td>
         <td colspan="1"><input type="textbox" name="t2" size="2"></td>
          <td colspan="1"><input type="textbox" name="t2" size="7"></td>
   </tr>
<tr>
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 37704792
have to try to align the field to the left:

<style type="text/css">
  td {text-align:left;"}
</style>
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

831 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