Never mind, I figured it out. It looks like the HTML Widget element is rendered as a full web page with html, head and body tags. I didn’t know that. So the padding that was bothering me was the auto margin of the body element.
Correct; if you don’t need it to be a separate page you can instead just use a Rectangle element. This is a <div> and you can just edit the Inner HTML basically the same way.