BigD Posted August 27, 2012 Share Posted August 27, 2012 Can someone please show code to lay 2 tables horizontally ? Thanks. Link to comment Share on other sites More sharing options...
scout1idf Posted August 27, 2012 Share Posted August 27, 2012 (edited) 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 August 27, 2012 by scout1idf Link to comment Share on other sites More sharing options...
BigD Posted August 27, 2012 Author Share Posted August 27, 2012 Yes. Thanks.What does table{} in style do? Without that tables will lay top to bottom. What does this do /*<![CDATA[*/ ? Link to comment Share on other sites More sharing options...
dsonesuk Posted August 27, 2012 Share Posted August 27, 2012 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 More sharing options...
BigD Posted August 29, 2012 Author Share Posted August 29, 2012 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 More sharing options...
BigD Posted August 29, 2012 Author Share Posted August 29, 2012 For Scout: I got it. Problem was due to the PHP coding. Thanks Scout. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 29, 2012 Share Posted August 29, 2012 /*<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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now