<!DOCTYPE html>
<html>
<body style="width: 0">
<fieldset>
<legend style="white-space: nowrap">This is legend text</legend>
This is other text
</fieldset>
</body>
</html>