How to break line in table cell when found space?

Viewed 22

I would like to new line to each <a> in <td> by not using <br>.

Show the result of row 1 exactly the same as row 2 without using <br>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<style>
  table > tbody > tr > td > a {
    display: block;
  }
</style>
<table class="table table-bordered">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">Link</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1.</td>
      <td>
        <a>Link 1</a>
        <a>Link 2</a>
      </td>
    </tr>
    <tr>
      <td>2.</td>
      <td>
        <a>Link 1</a>
        <br>
        <a>Link 2</a>
      </td>
    </tr>
  </tbody>
</table>

0 Answers
Related