Using HTML / CSS below, I have 3 tables. I would like tables 1 and 2 to be next to each other in the “same row” with table 3 below, but with a gap between them.
However, when I use float: left / right in the first two tables, is table 3 always located directly below it and “touches” the 1/2 tables?
I tried margin / clear / float and didn't seem to be able to output lines: (
Any help 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>
html css positioning
Bluechippy
source share