There are many things that browsers do that are not required by standards :-)
This page here (HTML4) indicates the legend keyword and indicates that it may contain inline elements of which the headers are not part. He has others, possibly useful ones, such as big or strong .
In addition, the corresponding H1 page does not list legend as one of the elements permitted for content. You can also use the id , class or style attributes of a legend to set basic text properties.
source share