【问题标题】:How to aligne text in a table using HTML in a Jupyter Notebook markdown cell?如何在 Jupyter Notebook Markdown 单元格中使用 HTML 对齐表格中的文本?
【发布时间】:2023-02-02 00:29:13
【问题描述】:

我想使用 HTML 代码(在 jupyter notebook markdown 单元格中)将表格中的文本左对齐。

文本对齐不起作用。

这是单元格的样子: enter image description here

这是我使用的代码:

<table>
  <tr style="font-size: 20px; font-weight: bold; text-align: center;">
    <td>Header 1</td>
    <td>Header 2</td>
  </tr>
  <tr style="font-size: 16px; text-align: right;">
    <td>Cell 1</td>
    <td>Cell 2</td>
  </tr>
  <tr style="font-size: 16px; text-align: right;">
    <td>Cell 3</td>
    <td>Cell 4</td>
  </tr>
</table>

【问题讨论】:

    标签: python html markdown jupyter


    【解决方案1】:

    您尝试使用文本对齐,请尝试使用“ALIGN="center""

    所以你的代码应该看起来像这样......

    <table>
      <tr style="font-size: 20px; font-weight: bold; text-align: center;">
        <td>Header 1</td>
        <td>Header 2</td>
      </tr>
      <tr style="font-size: 16px; text-align: right;">
        <td ALIGN="center">Cell 1</td>
        <td ALIGN="center">Cell 2</td>
      </tr>
      <tr style="font-size: 16px; text-align: right;">
        <td ALIGN="center">Cell 3</td>
        <td ALIGN="center">Cell 4</td>
      </tr>
    </table>
    

    【讨论】:

      猜你喜欢
      • 2017-11-16
      • 2020-02-15
      • 1970-01-01
      • 2020-02-11
      • 1970-01-01
      • 2018-04-14
      • 2023-03-04
      • 2010-12-14
      • 2018-10-16
      相关资源
      最近更新 更多