简体   繁体   English

如何在同一行上对齐HTML表和描述文本

[英]How to align a HTML table and description text on the same line

I have this table in html and I would wish to have this format where the description "C2B Payments" comes on the same line as the table as shown on the image, to the left on the same line and not on top of the table. 我使用html编写此表格,并且希望使用这种格式,其中“ C2B Payments”的描述与图片所示表格位于同一行,位于同一行的左侧,而不是表格的顶部。 However I cant figure out of a way to do it. 但是我不知道要怎么做。
Any one please lead me. 任何人都可以带领我。 Thank you 谢谢

<p class="align left"> C2B Payments</p>
<table border="0" align="center"; margin: 0 auto;">
  <thead>
    <tr>       
      <th>Date</th>
      <th>Total Received</th>
      <td>Failed</td>
    </tr>
  </thead>
  <tbody>

CSS 的CSS

  .alignleft {
      float: left;
       }

This?: https://jsfiddle.net/d8bpy3gk/ 这是?: https : //jsfiddle.net/d8bpy3gk/

    <p style="float:left; width:20%"> C2B Payments</p>
<table style="border:0; align:center; margin: 0 auto;float:left; width:80%">
  <thead>
    <tr>       
      <th>Date</th>
      <th>Total Received</th>
      <th>Failed</th>
    </tr>
  </thead>
  <tbody>
     <tr>       
      <th>10/10/10</th>
      <th>$ 200,00</th>
      <th>Failed</th>
    </tr>
  </tbody>

  </table>

Add two division 加二师

  • with float: left; 带浮点数:左;

  • with display: inline-block; 带显示:内联块; vertical-align: top; 垂直对齐:顶部;

and put paragraph in left and table in right 并将段落放在左边,表格放在右边

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM