色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

對于100%的表格,如何在內部水平均勻分布元素& lttd & gt?

黃文隆2年前10瀏覽0評論

例如,我有一個表,它的第一列包含一些長度不同的元素:

<table border="1" style="text-align:center;width:100%;">
  <tr><td><span>a</span></td><td>1</td></tr>
  <tr><td><span>a</span><span>a</span></td><td>1</td></tr>
  <tr><td><span>a</span><span>a</span><span>a</span></td><td>1</td></tr>
  <tr><td><span>a</span><span>a</span><span>a</span><span>a</span><td>1</td></tr>  
<table>

.spaceBetween {
  display: flex;
  justify-content: space-around;
}

<table border="1" style="text-align:center;width:100%">
  <tr class="container space-around">
    <td class="spaceBetween"><span>a</span></td>
    <td>1</td>
  </tr>
  <tr class="container space-around">
    <td class="spaceBetween"><span>a</span><span>a</span></td>
    <td>1</td>
  </tr>
  <tr class="container space-around">
    <td class="spaceBetween"><span>a</span><span>a</span><span>a</span></td>
    <td>1</td>
  </tr>
  <tr class="container space-around">
    <td class="spaceBetween"><span>a</span><span>a</span><span>a</span><span>a</span></td>
    <td>1</td>
  </tr>
</table>

要在表格的第一列中均勻分布元素,可以使用CSS將& quot文本對齊:兩端對齊屬性設置為該列中的單元格。下面是一個如何實現這一點的示例:

html
<style>
  .distribute {
    text-align: justify;
  }
</style>

<table>
  <tr>
    <td class="distribute">Element 1</td>
    <td>Value 1</td>
  </tr>
  <tr>
    <td class="distribute">Element 2</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td class="distribute">Element 3</td>
    <td>Value 3</td>
  </tr>
  <!-- Add more rows as needed -->
</table>

通過應用& quot分發& quot類添加到第一列的單元格中(在本例中是元素),& quot文本對齊:兩端對齊屬性將在每個單元格中均勻分布內容。通過這種方式,元素將被隔開以填充列的整個寬度。不要忘記調整表格的結構和內容,以適應您的特定需求。