I've come across this technique here [0] to try it on <object> elements, but sizing is even more difficult there.
[0]: https://www.filamentgroup.com/lab/html-includes/