1

Here's a snippet.

.outer-wrapper {
  align-items: stretch;
  display: flex;
  flex-flow: column nowrap;
}

.inner-wrapper {
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
}

table {
  border: 1px solid black;
  border-spacing: 0;
  flex-grow: 1;
}

td,
th {
  border-bottom: 1px solid black;
  border-right: 1px solid black;
  margin: 0;
  padding: 0.5rem;
}

td:last-child,
th:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}
<div class="outer-wrapper">
  <h1>Table</h1>
  <div class="inner-wrapper">
    <table>
      <thead>
        <th>Foo</th>
        <th>Bar</th>
      </thead>
      <tr>
        <td>Baz</td>
        <td>Qux</td>
      </tr>
    </table>
  </div>
</div>

If you run it in Chrome (and most browsers, fwiw), you get this:

Chrome snippet

But in Safari 13.0.2 on macOS it's like this:

Safari snippet

Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114

1 Answers1

1

Thanks to @Michael_B, I now understand that the table works in a rather peculiar way with flexbox styling.

It seems I must use width: 100% instead of flex-grow: 1. It's not the end of the world, since the table is at the deepest level in the dom hierarchy, but it's still a bummer.

Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114