473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Html Table

hi to all..

is it possible to make a table beside another table?
because when i am making 2 tables, the second one is placed under the 1st one..

for example: *# represents the table*
~ i want this to happen
# #

but this is what happens
#
#
Feb 8 '08 #1
9 1608
mrhoo
428 256MB
Its simplest to show you,
but briefly, enclose each table in a floating div that has a width set to 50% and a min-width set to insure against a too small window.
In this example the divs have a class:

.floatdiv{position:relative;min-width:400px;width:50%;float:left}

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>HTML Table Floats</title>
  6.  
  7. <style type="text/css">
  8. table{border:ridge black 3px;background-color:white;font-size:1em;width:90%}
  9. td,th{border:solid black 1px;padding:2px}
  10. .sortableClass    th{cursor:pointer}
  11. thead,tfoot{background-color:#eee;font-size:1.1em;font-weight:bold;text-align:center}
  12. .floatdiv{position:relative;min-width:400px;width:50%;float:left}
  13. </style>
  14.  
  15.  
  16. </head>
  17.  
  18. <body>
  19. <h1>HTML Elements</h1>
  20.  
  21. <div class="floatdiv">
  22. <table>
  23. <caption>Three Column Table</caption>
  24. <thead class="sortableClass">
  25. <tr><th>Make</th><th>Model</th><th>Price</th></tr>
  26. </thead>
  27. <tbody>
  28. <tr><td>Ford</td><td>Truck</td><td>$23,000</td></tr>
  29. <tr><td>Subaru</td><td>Wagon</td><td>$21,000</td></tr>
  30. <tr><td>Kia</td><td>Compact</td><td>$13,000</td></tr>
  31. <tr><td>Lexus</td><td>Sedan</td><td>$35,000</td></tr>
  32. <tr><td>Honda</td><td>SUV</td><td>$26,000</td></tr>
  33.  
  34. </tbody>
  35. </table>
  36. </div>
  37. <div class="floatdiv">
  38. <table>
  39. <caption>Three Column Table</caption>
  40. <thead class="sortableClass">
  41. <tr><th>Make</th><th>Model</th><th>Price</th></tr>
  42. </thead>
  43. <tbody>
  44. <tr><td>Ford</td><td>Truck</td><td>$23,000</td></tr>
  45. <tr><td>Subaru</td><td>Wagon</td><td>$21,000</td></tr>
  46. <tr><td>Kia</td><td>Compact</td><td>$13,000</td></tr>
  47. <tr><td>Lexus</td><td>Sedan</td><td>$35,000</td></tr>
  48. <tr><td>Honda</td><td>SUV</td><td>$26,000</td></tr>
  49.  
  50. </tbody>
  51. </table>
  52. </div>
  53.  
  54. </body>
  55. </html>
Feb 8 '08 #2
thanks for the reply!!
i'll try this when i get home and inform you with the result..
thanks again!!
Feb 8 '08 #3
i have already tried the code you've given me..
but the 2nd table is still under the 1st table,
what i want is for the 2nd table to be beside of the 1st table..
is what i want possible?
Feb 8 '08 #4
Hi Mirian,

try this,
[HTML]<body>
<table align="left"><tr><td>Table 1, Row 1, Cell 1</td></tr></table>
<table><tr><td>Table 2, Row 1, Cell 1</td></tr></table>
</body>[/HTML]
Feb 8 '08 #5
Death Slaught
1,137 1GB
Try this.

[HTML] <html>

<head>
<style type="text/css">
#table {
float:left;
display:inline;
}
</style>
</head>

<body>

<table id="table">
<tr>
<td>
Text
</td>
</tr>
</table>

<table>
<tr>
<td>
Text
</td>
</tr>
</table>

</body>

</html>
[/HTML]

^_^ Hope it helps, Thanks, Death
Feb 8 '08 #6
hi to all..

is it possible to make a table beside another table?
because when i am making 2 tables, the second one is placed under the 1st one..

for example: *# represents the table*
~ i want this to happen
# #

but this is what happens
#
#
Hi Buddy !
Its pretty simple.. all you have to do is to align both the tables to left ... ie
Expand|Select|Wrap|Line Numbers
  1. <table align = "left">
  2. <tr>
  3. <td>Here is the 1st table</td>
  4. </tr>
  5. </table>
  6.  
  7. <table align = "left">
  8. <tr>
  9. <td>Here is the 2nd table</td>
  10. </tr>
  11. </table>
Feb 8 '08 #7
Hi Mirian,

try this,
[HTML]<body>
<table align="left"><tr><td>Table 1, Row 1, Cell 1</td></tr></table>
<table><tr><td>Table 2, Row 1, Cell 1</td></tr></table>
</body>[/HTML]
Try this.

[HTML] <html>

<head>
<style type="text/css">
#table {
float:left;
display:inline;
}
</style>
</head>

<body>

<table id="table">
<tr>
<td>
Text
</td>
</tr>
</table>

<table>
<tr>
<td>
Text
</td>
</tr>
</table>

</body>

</html>
[/HTML]

^_^ Hope it helps, Thanks, Death
hey, thanks for helping me!!
big help!!
Feb 8 '08 #8
Hi Buddy !
Its pretty simple.. all you have to do is to align both the tables to left ... ie
Expand|Select|Wrap|Line Numbers
  1. <table align = "left">
  2. <tr>
  3. <td>Here is the 1st table</td>
  4. </tr>
  5. </table>
  6.  
  7. <table align = "left">
  8. <tr>
  9. <td>Here is the 2nd table</td>
  10. </tr>
  11. </table>
thank you also for helping..
that (align = "left") was my problem.. hehe..
stupid me..
Feb 8 '08 #9
Death Slaught
1,137 1GB
No problem. I would just like to point out that using the 'align' attribute isn't valid (unless you're using a transitional doctype), and that you should use CSS instead.

^_^ Thanks, Death
Feb 8 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: SteveJ | last post by:
All, Can someone help me solve the next step. First of all let me say I'm new to php. I pieced the following code together from samples I found on the net and a book I bought called PHP...
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
10
by: Peter Kirk | last post by:
Hi there can someone please help me with creating dynamic content in a table? For example, see the below javascript and html - why is a new row not created in the table when I click the button?...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
5
by: Andrew | last post by:
Hi, friends, In ASP, we use obj = CreateObject("com.dll") obj.GetHTMLText(inVal, outHTMLTxt1, outHTMLTxt2) to get different HTML strings based on input values. Then, we insert them into...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
2
by: lynx129 | last post by:
Hi there , I have php script that works fine under my server but I dont know how to put the html code inside my site. feedback.html <html dir="rtl"> <head> <title> ????? ??? </title>...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
2
by: sateeshchandrasanga | last post by:
Hi All, My HTML code is working fine in Firefox.But its not displaying any thing in IE.Can you help me in this problem.And in Google crown its displaying but not properly. ...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.