我用 PHP 生成了 2 个 HTML 表。第一个表始终位于第二个表之上。我似乎无法让他们肩并肩。第二个总是在第一个表下方。
我还尝试在表格的 html 中添加左浮动和内联的 html 样式,但它仍然没有并排出现。任何帮助将不胜感激!
//add table for bids and asks
function build_table($bidarray){
// start table
$html = '<table style="display: inline-block;">';
// header row
$html .= '<tr>';
foreach($bidarray[0] as $key=>$value){
$html .= '<th>' . htmlspecialchars($key) . '</th>';
}
$html .= '</tr>';
// data rows
foreach( $bidarray as $key=>$value){
$html .= '<tr>';
foreach($value as $key2=>$value2){
$html .= '<td>' . htmlspecialchars($value2) . '</td>';
}
$html .= '</tr>';
}
// finish table and return it
$html …Run Code Online (Sandbox Code Playgroud) php ×1