The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> arrange image beside table
weblogfinder
post Feb 14 2011, 12:51 PM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 20-January 11
Member No.: 13,642



Hi,

I have a table as below. I'm expecting the image to be displayed in a column beside the row entries. But the image is getting displayed in a separate row.

Can any one please help me out on how to resolve this.


<table>
<tr>
<td>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
</tr>
<tr>
<td>Four</td>
<td>Five</td>
<td>Six</td>
</tr>
<tr>
<td>Seven</td>
<td>Eight</td>
<td>Nine</td>
</tr>
</td>
<td>
<img src="test.png" />
</td>
</tr>
</table>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 14 2011, 01:43 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



The table isn't right. There are TD and TR tags sprinkled a little at random.

CODE
<table>
<tr>
  <td>
    <tr>

The last TR above has nothing there to do. Remove it. The TD is superfluous too since you have a TD below.


CODE
      <td>One</td>
      <td>Two</td>
      <td>Three</td>
    </tr>
    <tr>
      <td>Four</td>
      <td>Five</td>
      <td>Six</td>
    </tr>
    <tr>
      <td>Seven</td>
      <td>Eight</td>
      <td>Nine</td>
    </tr>
  </td>


The above is fine upto the last </td>. Remove it.

CODE
  <td>
   <img src="test.png" />
  </td>


This is all wrong because it isn't in a table row.

CODE
</tr>
</table>


That's the correct way to finish a table. smile.gif

If you want the image to the right of the text cells you need to add one more column. That means one more cell in one of the rows. The first seems suitable.

CODE
<table>
<tr>
  <td>One</td>
   <td>Two</td>
   <td>Three</td>
   <td rowspan="3"><img src="test.png" /></td>
</tr>

Since you have three rows in the table but want to melt the rightmost cells together for the image you use rowspan="3".


The principle is this. TABLE contains a number of TR. Each TR can contain a number of TD. The elments must come in that order. The TDs must add up for each row and each column (it's a grid). You use colspan or rowspan to melt cells together to a larger cell.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
weblogfinder
post Feb 14 2011, 06:08 PM
Post #3


Newbie
*

Group: Members
Posts: 12
Joined: 20-January 11
Member No.: 13,642



Thanks for the detailed reply.

I would like to have the image to be independent of the table rows.

For this, Do i have to create another table?.

Because, With the above method height of table row is adjusted with the image present.

Let me know how i can proceed with this
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 15 2011, 02:33 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Hard to guess since you had placed it in the table. wink.gif

No, you don't need another table. You can use several approaches. One is to float either the table or the image, with the align attribute in HTML or better with CSS float. I'd float the table to the left rather than the image to the right. If you haven't started with CSS yet it's fine to stick to HTML 'align'.

http://htmlhelp.com/reference/html40/tables/table.html
http://htmlhelp.com/reference/css/box/float.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd April 2024 - 06:20 AM