Just as assumption, but it may be related to the fact that both examples do not produce valid HTML and therefore the browser tries it’s best in compatibility modes.
Local files may be treated totally different than actual HTTP resources, as local files do not have any header information attached that may affect the initial rendering mode.
Unless you send valid HTML to the browser you may assume nothing. And even if, you may only assume the browser does it’s best. And this best may be different from what you expect.