<!DOCTYPE HTML>
<html>
<body>
<style>
p { flex-grow: 1; }
</style>
<fieldset style="display:flex; overflow:hidden; width:200px; height:200px;">
  <legend>Legend</legend>
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
</fieldset>
<fieldset style="display:flex;">
  <legend>Legend</legend>
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
  <p>X
</fieldset>
</body>
</html>