What's the problem with my TABLE?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

What's the problem with my TABLE?

Post by MarK (CZ) »

Hi!

I'm sometimes getting mad why is my IE not following my commands. Here's my code:

Code: Select all

<table>
 <tr>
  <td rowspan='2' style='width: 130px;'>
   <img src='images/img.php?img=man' alt='photo' style='width: 120px; height: 150px; float: left;' align='left'></img>
  </td>
  <td style='height: 25px; font-size: 11pt; border-bottom: 1pt solid black;'>Name</td>
 </tr>
 <tr>
  <td>text</td>
 </tr>
</table>
The border between the top-right and bottom-right fields stays somewhere in the middle. What am I doing wrong??? :?
Thanks! :)
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Add colspan="2" in your second td tag

Code: Select all

<table>
 <tr>
  <td rowspan='2' style='width: 130px;'>
   <img src='images/img.php?img=man' alt='photo' style='width: 120px; height: 150px; float: left;' align='left'></img>
  </td>
  <td style='height: 25px; font-size: 11pt; border-bottom: 1pt solid black;'>Name</td>
 </tr>
 <tr>
  <td colspan=&quote;2&quote;>text</td>
 </tr>
</table>
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

That does not help :(

And anyway, I can't see the point why it should be there??

Code: Select all

----------------------------
|         |                |
|         |                |
|rowspan=2|----------------|
|         |                |
|         |                |
----------------------------
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Ha ha - language barriers are great!

~hawleyjr meant to put "rowspan=2" as an attribute of the second <td> tag, exactly like it is in the first. The updated code should look like this:

Code: Select all

<table>
 <tr>
  <td rowspan='2' style='width: 130px;'>
   <img src='images/img.php?img=man' alt='photo' style='width: 120px; height: 150px; float: left;' align='left'></img>
  </td>
  <td style='height: 25px; font-size: 11pt; border-bottom: 1pt solid black;'>Name</td>
 </tr>
 <tr>
  <td colspan=&quote;2&quote;>text</td>
 </tr>
</table>
but that'll still give you a table like this:

Code: Select all

----------------------------
|         |       Name     |
|         |                |
| Image   |----------------|
|  here   |      text      |
|         |                |
----------------------------
What shape of table are you trying to make?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

Your code is exactly the same as hawleyjr posted, no '"rowspan=2" as an attribute of the second <td> tag'... 8O

I get this table fine, the layout is just as I'd like to have it. But I want to change the height of the right-top cell and setting 'height: 25px;' as a style for the TD doesn't behave as I need. Maybe it's just IE having fun of me.. :?
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Guess only way is to set height of text td too.

Code: Select all

<table>
 <tr>
  <td rowspan=&quote;2&quote; style=&quote;height:150px; width: 130px;&quote;>
   <img src=&quote;images/img.php?img=man&quote; alt=&quote;photo&quote; style=&quote;width: 120px; height: 150px; float: left;&quote; align=&quote;left&quote;/>
  </td>
  <td style=&quote;height: 25px; font-size: 11pt; border-bottom: 1pt solid black;&quote;>Name</td>
 </tr>
 <tr>
  <td style=&quote;height: 125px&quote;>text</td>
 </tr>
</table>
Post Reply