Jump to content

How to lay 2 tables horizontally


BigD

Recommended Posts

Do you mean like this?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>  <title></title>  <style type="text/css">  /*<![CDATA[*/table{	 width:30%;	 border:3px solid black;	 float:left;	 margin-left:5%;}td{	 border:1px dotted black;}  /*]]>*/  </style></head><body>	 <table>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>	 </table>	 <table>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>		  <tr>			   <td> </td><td> </td><td> </td>		  </tr>	 </table></body></html>

Edited by scout1idf
Link to comment
Share on other sites

Alternatively use display: inline-table; the table will be treated like text and align as such, and at the same time be either centred, left or right;

<style type="text/css">.t_wrapper {width: 960px; text-align:center; margin:0 auto;}.t_wrapper table { display:inline-table; *display:inline; /*IE 7*/ width:40%; padding:0; border-spacing:0; border-spacing: expression(cellSpacing=0); /*older IE*/ border-collapse:collapse; margin:5px; }.t_wrapper table td {border: 1px solid black; }</style>

<div class="t_wrapper"><table>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr></table><table>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr>  <tr>    <td> </td>    <td> </td>  </tr></table></div>

Link to comment
Share on other sites

Question for Scout: I tried your code and it worked.When I tried to incorporate that into my code, I got syntext error. It did not like the curly bracket after the table in style section. I have 2 styles, did I do it wrong?<?php//header("Pragma: no-cache");//header("Expires: 0");/*<head><style>@page { size 8.5in 11in; margin: 2cm }div.page { page-break-after: always }</style><style type="text/css"> /*<![CDATA[*/table{ width:40%; border:3px solid black; float:left; margin-left:5%;}td{ border:1px dotted black;} /*]]>*/ </style></head>?>

Link to comment
Share on other sites

/*<head><style>@page { size 8.5in 11in; margin: 2cm }div.page { page-break-after: always }</style><style type="text/css">/*<![CDATA[*/table{width:40%;border:3px solid black;float:left;margin-left:5%;}td{border:1px dotted black;}/*]]>*/</style></head>?> it maybe the comment tag at top to the end closing comment tag causing problem

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...