html - css positioning tables next to each other -


using html/css below have 3 tables. table 1 , 2 next each other on "same line" table 3 underneath break between them.

however, when use float:left/right on first 2 tables, table 3 directly underneath , "touching" tables1/2?

i have tried margin/clear/float , can't seem make things line :(

any gratefully received.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title>untitled page</title>     <style type="text/css">         div.search         {             width: 80%;             margin-right: auto;             margin-left: auto;         }          div.search table         {             border: 1px solid black;             border-collapse: separate;         }          div.search table.table1         {             float: left;             width: 45%;         }          div.search table.table2         {             float: right;             width: 45%;         }          table.table3         {             border: 1px solid black;             margin-top: 50px;             margin-right: auto;             margin-left: auto;             width: 80%;         }     </style> </head> <body>     <div class="search">         <table class="table1">             <tr>                 <td>                     table 1                 </td>             </tr>         </table>         <table class="table2">             <tr>                 <td>                     table 2                 </td>             </tr>         </table>     </div>     <table class="table3">         <tr>             <td>                 table 3             </td>         </tr>     </table> </body> </html> 

you should apply additional styles:

div.search {     width: 80%;     margin-right: auto;     margin-left: auto;      overflow: hidden; /* fixing problem in modern browsers */     zoom: 1; /* fixing in old ie applying haslayout */     padding-bottom: 50px; /* prefer padding here margin in table3 */ }  table.table3 {     border: 1px solid black;     /* margin-top: 50px; */     margin-right: auto;     margin-left: auto;     width: 80%; } 

you can try use :after (in answer below), old ie doesn't support it.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -