1

I built an HTML table:

<table cellpadding="0" cellspacing="0" border="0" style="width:1000px" id="maintable">
  <thead>
    <tr>
      <th class="asc" width="30"><h3>ID</h3></th>
      <th width="200"><h3>Name</h3></th>
      <th width="200"><h3>Artist</h3></th>
      <th width="150"><h3>Album</h3></th>
      <th width="60"><h3>Time</h3></th>    
    </tr>
  &lt/thead>    
    <tr class="evenrw">
      <td class="evensl" align="center">i++</td>
      <td align="left"><a href="link">link name</a></td>
      <td align="left">name</td>
      <td align="left">name</td>
      <td align="center">name</td>   
    <tr>
<table>  

the problem is that when I put something in a row so that the whole table becomes bigger, Is there anyway to make the height of the cell bigger instead the width of the cell?

JK.
  • 5,126
  • 1
  • 27
  • 26
YosiFZ
  • 7,792
  • 21
  • 114
  • 221
  • Try forcing a width with CSS; this should push the content together, making the cell taller to fit it all. – Bojangles Jul 25 '11 at 07:01
  • Check this question for answer. [Word-wrap in a html table][1] [1]: http://stackoverflow.com/questions/1258416/word-wrap-in-a-html-table – Shoban Jul 25 '11 at 07:02
  • but the problem is that if i have a small text i only need one line,but is the text is long i need two lines for this. – YosiFZ Jul 25 '11 at 07:02

2 Answers2

1

You have a table width set as 1000px, and individual table columns set to a total with of around 600px. Tables a bit confusing with widths so remove the style="1000px" and that should fix the problem

jsfiddle example

If the answer works, please mark it as the chosen answer :)

PART TWO

To add a banner above the table, simply add another <div> above the table. So it would be

<div id="banner_or_something">
    <!-- INSERT BANNER CODE HERE-->
</div>
<table cellpadding="0" cellspacing="0" border="0" style="width:1000px" id="maintable">
    <!--TABLE CODE HERE-->
</table>
LeeR
  • 1,609
  • 11
  • 29
  • and if i have a banner in the top of the table that need to be in the same Width of the table? – YosiFZ Jul 25 '11 at 07:11
  • 1
    Then add it in the code above so we can work with all your code. – LeeR Jul 25 '11 at 07:12
  • How wide is your banner? Is it going inside the table, or above the table? Is it to go below the or above... If above, it kind of make the not a but that's another story. Can you please provide some more information.... – LeeR Jul 25 '11 at 07:19
  • the wide is like the table: 1000 and it is above the table – YosiFZ Jul 25 '11 at 07:23
0

Use CSS div & class with td tags will help you. e.g.

.aaa td{
width:200px;
/* all attributes you want*/
}

i hope it will help you

Sumant
  • 954
  • 1
  • 18
  • 39