我一直在使用这个网站、W3 Schools和类似问题的Stack Overflow页面,将我的表格(在一个div中)与页面第二部分的另一个div并排显示。
我试图在屏幕上添加垂直分割线,但是右侧的内容会导致左侧下沉。左侧唯一的内容是通过PHP填充的表格,但我感觉这部分代码导致了对齐问题。
目前的情况如下图所示,但我希望能够在右侧div中添加内容而不会使左侧div下沉:
代码:
我试图在屏幕上添加垂直分割线,但是右侧的内容会导致左侧下沉。左侧唯一的内容是通过PHP填充的表格,但我感觉这部分代码导致了对齐问题。
目前的情况如下图所示,但我希望能够在右侧div中添加内容而不会使左侧div下沉:
![enter image description here](https://istack.dev59.com/zYRxc.webp)
.floating-box {
display: inline-block;
width: 45%;
height: 75px;
margin: 0px;
border: 1px solid #73AD21;
}
<div class="floating-box">
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
<th>Column 5</th>
<th>Column 6</th>
<th>Column 7</th>
<th>Column 8</th>
<th>Column 9</th>
<th>Column 10</th>
<th>Column 11</th>
<th>Column 12</th>
</tr>
</thead>
<tbody>
<?php foreach ($allArray as $key => $value) { ?>
<?php } ?>
</tbody>
</table>
</div>
<div class="floating-box">
<h2>Floating box</h2>
</div>